/* ===== 基本設定 ===== */
/*
 * !important 使用方針:
 * - Tailwind CDN のユーティリティクラス上書きに必須
 * - Leaflet (第三者ライブラリ) のインラインスタイル上書きに必須
 * - メディアクエリ内での Tailwind override に必須
 * 上記以外では !important を使用しないこと
 */
body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    scroll-behavior: smooth;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: hidden !important; overscroll-behavior: none; }
/* モバイルのスクロールラグ対策 */
@media (max-width: 768px) {
    html { scroll-behavior: auto; }
}

/* ===== タイポグラフィ ===== */
.text-huge {
    font-size: clamp(3.8rem, 15vw, 11.5rem);
    line-height: 0.9;
    letter-spacing: -0.06em;
}
.bg-number {
    font-size: clamp(4.5rem, 20vw, 11rem);
    font-weight: 900;
    color: rgba(0, 0, 0, 0.04);
    line-height: 1;
    display: inline-block;
    pointer-events: none;
    z-index: 0;
    margin-bottom: -1.5rem;
}
.keep-all {
    word-break: keep-all;
    overflow-wrap: anywhere;
}

/* ===== ナビゲーション ===== */
#navbar.scrolled {
    backdrop-filter: blur(12px);
    background-color: rgba(255, 255, 255, 0.9);
    will-change: transform;
}

/* ===== スクロールバー ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #000; }

/* ===== Vehicle（展開図）画像 ===== */
.vehicle-wrap { padding: 16px; }
.vehicle-figure img {
    max-width: 100%;
    height: auto;
    max-height: clamp(180px, 30vh, 420px);
    object-fit: contain;
    display: block;
    margin: 0 auto;
}
.vehicle-figure picture {
    display: block;
    width: 100%;
    max-width: 100%;
}

/* ===== Stat Cards（デスクトップ基本） ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 16px;
    justify-items: center;
    align-items: start;
    max-width: 720px;
    margin: 1.25rem auto 0;
    padding: 0 12px;
}
.stat-card {
    width: 100%;
    aspect-ratio: 1 / 1;
    min-width: 140px;
    max-width: 320px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    overflow: hidden;
    text-align: center;
}
.stat-label {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 6px;
    white-space: nowrap;
}
.stat-number {
    font-weight: 900;
    line-height: 0.92;
    font-size: clamp(1.4rem, 5vw, 2.6rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== 免許証アップロードエリア ===== */
.license-upload-area {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1.585 / 1; /* 免許証の比率 */
    border: 2px dashed rgba(0,0,0,0.2);
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    background: #fafafa;
    transition: border-color 0.2s, background 0.2s;
}
.license-upload-area:hover {
    border-color: #f97316;
    background: #fff7ed;
}

/* ===== 標準設備タグ ===== */
.equip-tag {
    display: inline-block;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #1a1a1a;
    background: #f0f0f0;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 100px;
    white-space: nowrap;
    line-height: 1.4;
    transition: background 0.15s;
}
.equip-tag:hover {
    background: #e2e2e2;
}
.equipment-list h4 {
    border-left: 4px solid #f97316;
    padding-left: 10px;
}

/* ===== アクセシビリティ ===== */
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(255,165,0,0.9);
    outline-offset: 2px;
}

/* ===== モーダル ===== */
#reserve-modal > div {
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

/* ===== カレンダー ===== */
#calendar {
    overflow: hidden;
}

/* ===== Leaflet マップ関連 ===== */
.poi-label {
    background: rgba(255,255,255,0.95);
    color: #000;
    padding: 4px 8px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(0,0,0,0.06);
}
.leaflet-tooltip.poi-label.leaflet-tooltip-right { transform: translateX(6px); }
.map-note {
    font-size: 13px;
    color: rgba(0,0,0,0.55);
    margin-left: 6px;
}
.inline-icon {
    width: 16px;
    height: 26px;
    vertical-align: middle;
    margin-right: 8px;
}
.map-legend-button { display: inline-flex; align-items: center; gap: 6px; }
.map-controls button { border-radius: 6px; }
.map-controls { display: flex; align-items: center; z-index: 10000 !important; pointer-events: auto; }
.map-controls button { pointer-events: auto; }
.leaflet-container .leaflet-control-container { z-index: 650 !important; }
.map-controls.map-controls-outside {
    position: static !important;
    transform: none !important;
    left: auto !important; right: auto !important;
    top: auto !important; bottom: auto !important;
    margin-top: 12px;
}
.map-controls.map-controls-outside button { border-radius: 8px; transition: all .15s; }
.map-controls.map-controls-outside .map-legend-button { gap: 8px; }
.map-controls.map-controls-outside img.inline-icon { margin-right: 6px; }

/* フィルターボタン選択状態 */
.map-legend-button.filter-active,
button.filter-active {
    background: #f97316 !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(249,115,22,.4);
    transform: translateY(-1px);
}

/* ===== Overflow & layout safety ===== */
header .absolute.inset-0 img {
    max-width: 100vw;
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: center;
}
.map-bleed {
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
}
.map-bleed > .bg-white {
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
}

/* ===============================================================
   デスクトップ用メディアクエリ
   =============================================================== */
@media (min-width: 1024px) {
    .stat-grid { max-width: 640px; }
    .stat-card { max-width: 300px; }
}
@media (min-width: 1200px) {
    .stat-grid { gap: 24px; }
    .stat-card { max-width: 300px; }
}
@media (max-width: 1024px) {
    #map { margin-top: 6px; }
}

/* ===============================================================
   タブレット（768px以下）
   =============================================================== */
@media (max-width: 768px) {
    .bg-number { margin-bottom: -0.5rem; }
    .map-bleed {
        margin-left: -24px;
        margin-right: -24px;
        width: calc(100% + 48px);
        padding-left: 0;
        padding-right: 0;
    }
    html, body { max-width: 100%; overflow-x: hidden; }
    .map-controls .inline-icon { width: 14px; height: 22px; }
}

/* ===============================================================
   モバイル向けマップ最適化（700px以下）
   =============================================================== */
@media (max-width: 700px) {
    .poi-label { display: none !important; }
    #map { min-height: 55vh; height: 55vh; }

    /* マップフレーム: ボーダー削除してフルブリード */
    .map-bleed .bg-white,
    .map-bleed > div {
        border-width: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    /* ボタン: マップ直下にコンパクトに */
    .map-controls.map-controls-outside {
        margin-top: 10px !important;
        gap: 6px !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
    .map-controls.map-controls-outside button {
        padding: 8px 12px !important;
        font-size: 12px !important;
        border-radius: 6px !important;
    }
    .map-controls .inline-icon { width: 12px; height: 18px; margin-right: 4px !important; }

    /* セクション余白縮小 */
    #map-section { padding-top: 0.5rem !important; padding-bottom: 0.75rem !important; }
    #map-section .map-note { font-size: 11px; margin-top: 6px; line-height: 1.5; }

    /* ズームコントロールモバイル調整 */
    .leaflet-control-zoom { margin-bottom: 8px !important; margin-right: 8px !important; }
    .leaflet-control-zoom a { width: 30px !important; height: 30px !important; line-height: 30px !important; font-size: 16px !important; }
}

/* マップタッチガード */
.map-touch-guard {
    position: absolute;
    inset: 0;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.08);
    cursor: pointer;
    transition: opacity .3s;
}
.map-touch-guard.hidden {
    opacity: 0;
    pointer-events: none;
}
.map-touch-hint {
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 24px;
    letter-spacing: .05em;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
    animation: hintPulse 2s infinite;
}
@keyframes hintPulse {
    0%, 100% { opacity: .85; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.03); }
}

/* ===============================================================
   モバイル統合（640px以下）— 全モバイルルールをここに集約
   =============================================================== */
@media (max-width: 640px) {
    /* --- タイポグラフィ --- */
    .text-huge {
        font-size: clamp(2.6rem, 18vw, 6.5rem);
        line-height: 1.0;
    }

    /* --- ヒーロー & ナビ --- */
    #navbar { padding-top: 6px !important; padding-bottom: 6px !important; }
    header { min-height: 70vh; }
    header .relative.z-10 { padding-bottom: 3.5rem !important; }

    /* --- タッチターゲット --- */
    button, input, select {
        font-size: 16px;
        padding: 12px 14px;
    }

    /* --- モーダル --- */
    #reserve-modal { padding-left: 12px; padding-right: 12px; }

    /* --- Vehicle（tenkaiz）画像 --- */
    .vehicle-wrap {
        padding: 2px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        overflow: hidden;
        box-sizing: border-box;
        border: none !important;
        box-shadow: none !important;
    }
    .vehicle-figure {
        margin: 0;
        width: 100%;
        max-width: 100%;
        display: block;
        overflow: hidden;
    }
    .vehicle-figure picture {
        display: block;
        width: 100%;
        max-width: 100%;
    }
    .vehicle-figure img {
        object-fit: contain;
        width: 100%;
        max-width: 100%;
        height: auto;
        display: block;
        max-height: none;
        object-position: center;
    }
    img.max-w-full {
        max-width: 100% !important;
        height: auto !important;
        display: block;
    }

    /* --- Stat Cards モバイル --- */
    .stat-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 320px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding: 0 4px !important;
    }
    .stat-card {
        aspect-ratio: auto !important;
        padding: 10px 6px !important;
        border-radius: 8px !important;
        min-width: 0 !important;
        max-width: none !important;
        width: 100% !important;
    }
    .stat-label { font-size: 0.55rem !important; letter-spacing: 0.08em !important; margin-bottom: 2px !important; }

    /* --- 標準設備タグ モバイル --- */
    .equip-tag {
        padding: 3px 8px;
        font-size: 0.65rem;
    }
    .equipment-list h4 {
        font-size: 0.75rem !important;
        margin-bottom: 6px !important;
    }
    .stat-number { font-size: 1.3rem !important; }

    /* --- Fleet section --- */
    section#car { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    section#car .max-w-\[1440px\] { padding-left: 8px !important; padding-right: 8px !important; }
    section#car .grid-cols-12 { gap: 10px !important; }
    section#car .border-b-2 { padding-bottom: 8px !important; margin-bottom: 12px !important; }

    /* --- Safe area --- */
    body { padding-bottom: env(safe-area-inset-bottom, 12px) !important; }

    /* --- Calendar --- */
    #calendar { display: grid !important; grid-template-columns: repeat(7, 1fr) !important; overflow-x: visible !important; padding: 0 !important; gap: 0 !important; }
    #calendar > div { min-width: 0 !important; padding: 0 !important; }
}

/* ===============================================================
   極小画面（480px以下）
   =============================================================== */
@media (max-width: 480px) {
    .bg-number { display: none; }
    body { line-height: 1.7; }
    p { font-size: 15px; }
}

/* ===============================================================
   カレンダー
   =============================================================== */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.cal-head {
    padding: 10px 4px;
    text-align: center;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .1em;
    background: #000;
    color: #fff;
    border-right: 1px solid #222;
    border-bottom: 1px solid #222;
}
.cal-head:last-of-type { border-right: none; }
.cal-head.sun { color: #f97316; }
.cal-head.sat { color: #60a5fa; }

.cal-cell {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    border-right: 1px solid rgba(0,0,0,.08);
    border-bottom: 1px solid rgba(0,0,0,.08);
    position: relative;
    transition: background .15s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.empty { background: transparent; }

.cal-cell.available {
    cursor: pointer;
    color: #111;
}
.cal-cell.available:hover { background: #f0fdf4; }
.cal-cell.available.sun { color: #ea580c; }
.cal-cell.available.sat { color: #2563eb; }

.cal-cell.booked {
    background: #f97316;
    color: #fff;
    cursor: not-allowed;
}
.cal-cell.booked::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 3px,
        rgba(255,255,255,.18) 3px,
        rgba(255,255,255,.18) 5px
    );
    pointer-events: none;
}

.cal-cell.past {
    background: rgba(0,0,0,.04);
    color: rgba(0,0,0,.2);
    cursor: default;
}

.cal-cell.today {
    box-shadow: inset 0 0 0 2px #f97316;
    border-radius: 4px;
}

/* 範囲選択ハイライト */
.cal-cell.cal-sel-start {
    background: #f97316 !important;
    color: #fff !important;
    border-radius: 6px 0 0 6px;
    z-index: 1;
}
.cal-cell.cal-sel-end {
    background: #f97316 !important;
    color: #fff !important;
    border-radius: 0 6px 6px 0;
    z-index: 1;
}
.cal-cell.cal-sel-start.cal-sel-end {
    border-radius: 6px;
}
.cal-cell.cal-sel-range {
    background: #fed7aa !important;
    color: #9a3412 !important;
}
.cal-cell.cal-sel-range.booked {
    background: #fecaca !important;
    color: #dc2626 !important;
}

/* 月ドット */
.cal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: all .15s;
}
.cal-dot:hover { border-color: #f97316; }
.cal-dot.active {
    background: #f97316;
    border-color: #f97316;
    transform: scale(1.3);
}

@media (max-width: 640px) {
    .cal-cell { font-size: 11px; aspect-ratio: 1 / 0.8; }
    .cal-head { font-size: 8px; padding: 6px 2px; letter-spacing: 0; }
    #cal-month-label { font-size: 1rem; min-width: 140px !important; }
    #cal-nav button { width: 34px; height: 34px; font-size: 16px; }
    .cal-dot { width: 8px; height: 8px; }
    #cal-dots { gap: 4px; }
}

/* ===============================================================
   Pricing Section
   =============================================================== */
.pricing-card {
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
    border-radius: 12px;
}
.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.pricing-card--featured {
    background: rgba(249,115,22,.06);
}
.pricing-reserve-btn {
    border-radius: 8px;
    transition: all .2s ease;
}
@media (max-width: 640px) {
    #pricing h2 { font-size: 2.2rem; }
    #pricing .text-3xl, #pricing .md\:text-4xl { font-size: 1.75rem; }
    .pricing-card { border-radius: 10px; }
}

/* ===============================================================
   約款モーダル
   =============================================================== */
.yakkan-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: yakkanFadeIn .2s ease;
}
@keyframes yakkanFadeIn { from { opacity: 0; } to { opacity: 1; } }

.yakkan-modal-box {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    overflow: hidden;
}
.yakkan-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e5e5e5;
    background: #fafafa;
    flex-shrink: 0;
}
.yakkan-modal-title {
    font-size: 14px;
    font-weight: 900;
    color: #333;
    letter-spacing: .04em;
}
.yakkan-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #999;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.yakkan-modal-close:hover { background: #f0f0f0; color: #333; }

.yakkan-modal-body {
    overflow-y: auto;
    padding: 20px 24px 24px;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.yakkan-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #e5e5e5;
    background: #fafafa;
    text-align: center;
    flex-shrink: 0;
}
.yakkan-modal-ok-btn {
    padding: 10px 32px;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    background: #f97316;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
}
.yakkan-modal-ok-btn:hover { background: #ea580c; }

/* 約款コンテンツ内のスタイリング */
.yakkan-title {
    font-size: 18px;
    font-weight: 900;
    text-align: center;
    margin: 0 0 20px;
    color: #111;
    letter-spacing: .15em;
}
.yakkan-chapter {
    font-size: 14px;
    font-weight: 900;
    color: #f97316;
    margin: 24px 0 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid #fed7aa;
}
.yakkan-article {
    font-size: 13px;
    font-weight: 800;
    color: #333;
    margin: 16px 0 4px;
}
.yakkan-p {
    font-size: 12px;
    line-height: 1.75;
    color: #444;
    margin: 0 0 4px;
}

@media (max-width: 640px) {
    .yakkan-modal-overlay { padding: 8px; }
    .yakkan-modal-box { max-height: 90vh; border-radius: 10px; }
    .yakkan-modal-body { padding: 16px; }
    .yakkan-title { font-size: 16px; }
    .yakkan-chapter { font-size: 13px; }
    .yakkan-article { font-size: 12px; }
    .yakkan-p { font-size: 11px; }
}

/* ===== 料金計算ウィジェット ===== */
#price-calculator {
  background: #0d0d0d;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  padding: 36px 28px;
  max-width: 480px;
  margin: 0 auto 56px;
  text-align: center;
}
.calc-label {
  color: #f90;
  font-size: 11px;
  letter-spacing: 3px;
  margin-bottom: 8px;
  font-weight: 600;
}
.calc-title {
  color: #fff;
  font-size: 18px;
  margin-bottom: 28px;
  font-weight: 500;
}
.nights-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 28px;
}
.nights-btn {
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nights-btn:hover {
  background: #f90;
  color: #000;
  border-color: #f90;
}
.nights-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
#nights-num {
  color: #fff;
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  min-width: 70px;
  text-align: center;
  transition: all 0.15s;
}
.nights-unit {
  color: #888;
  font-size: 18px;
}
.calc-result {
  background: #151515;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  text-align: left;
}
.calc-plan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.plan-badge {
  color: #f90;
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  background: rgba(255,153,0,0.1);
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255,153,0,0.3);
}
.discount-badge {
  color: #4ade80;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}
.calc-breakdown {
  color: #888;
  font-size: 14px;
  margin-bottom: 10px;
}
.calc-total {
  color: #fff;
  font-size: 30px;
  font-weight: 700;
}
#stripe-pay-btn {
  width: 100%;
  background: #f90;
  color: #000;
  border: none;
  border-radius: 10px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}
#stripe-pay-btn:hover {
  background: #ffaa22;
  transform: translateY(-1px);
}
#stripe-pay-btn:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
  transform: none;
}
.calc-note {
  color: #555;
  font-size: 11px;
  margin-top: 12px;
}
