html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    /* iOS固定 */
    position: fixed;
    width: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    /* iOS Safari対応 */
    position: relative;
    width: 100%;
}

#main-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: calc(100vh - 110px);
    overflow: hidden;
}

/* 上部セクション: 情報・写真・地図 */
#top-section {
    display: flex;
    flex-direction: row;
    height: 75%;
    border-bottom: 2px solid #ddd;
    flex-grow: 1;
}

/* 左半分: 情報・写真エリア */
#left-section {
    width: 50%;
    height: 100%;
    display: flex;
    flex-direction: row;
    border-right: 2px solid #ddd;
}

/* 写真情報セクション (左上の左1/4) */
#photo-info-section {
    width: 25%;
    height: 100%;
    background-color: #fafafa;
    overflow-y: auto;
    padding: 15px;
    border-right: 2px solid #ddd;
}

/* 写真表示セクション (左上の右3/4) */
#photo-display-section {
    width: 75%;
    height: 100%;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 地図セクション (右半分) */
#map-section {
    width: 50%;
    height: 100%;
    position: relative;
}

#current-photo-display {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#photo-display-placeholder {
    color: #999;
    font-size: 18px;
    text-align: center;
}

#current-photo-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
}

/* 回転時の写真表示サイズ制限 */
#current-photo-image.rotated-90,
#current-photo-image.rotated-270 {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

#current-photo-image.rotated-180 {
    max-width: 100%;
    max-height: 100%;
}

#photo-info-content {
    font-size: 13px;
    line-height: 1.6;
}

/* 全画面表示ボタン */
.fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 50; /* 他の要素の下に配置 */
    padding: 8px 12px;
    background-color: rgba(33, 150, 243, 0.9);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.fullscreen-btn:hover {
    background-color: rgba(33, 150, 243, 1);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.fullscreen-btn:active {
    transform: scale(0.95);
}

/* キャプチャボタン */
.capture-btn {
    position: absolute;
    top: 10px;
    right: 50px;
    z-index: 50; /* 他の要素の下に配置 */
    padding: 8px 12px;
    background-color: rgba(76, 175, 80, 0.9);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.capture-btn:hover {
    background-color: rgba(76, 175, 80, 1);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.capture-btn:active {
    transform: scale(0.95);
}

/* 全画面表示時のスタイル */
.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background-color: #f5f5f5 !important;
}

.fullscreen-mode #current-photo-image {
    max-width: 100vw;
    max-height: 100vh;
}

/* 写真情報パネルのスタイル */
.photo-info-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.info-field label {
    font-weight: bold;
    font-size: 12px;
    color: #555;
    white-space: nowrap;
    min-width: fit-content;
}

.info-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.info-input:focus {
    outline: none;
    border-color: #2196f3;
    background-color: #f0f8ff;
}

.info-field > div {
    flex: 1;
}

.direction-control {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
}

.direction-control input {
    width: 50px;
    text-align: center;
}

.custom-fields-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* PC用コントロール */
.pc-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex: 1;
}

/* モバイル用コントロール（デフォルトは非表示） */
.mobile-controls {
    display: none;
}

/* モバイル用写真表示モーダル */
.mobile-photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    overflow-y: auto;
}

.mobile-photo-modal-content {
    width: 100%;
    min-height: 100vh;
    background: white;
    position: relative;
    display: flex;
    flex-direction: column;
}

.mobile-modal-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 30px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mobile-photo-display {
    width: 100%;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.mobile-photo-display img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.mobile-photo-info {
    width: 100%;
    padding: 15px;
    background: white;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.mobile-photo-info .photo-info-panel {
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
}

.mobile-photo-info .info-field {
    margin-bottom: 12px;
    max-width: 100%;
    box-sizing: border-box;
}

.mobile-photo-info .info-input,
.mobile-photo-info .direction-input {
    font-size: 14px;
    padding: 6px;
    max-width: 100%;
    box-sizing: border-box;
}

.mobile-photo-info .direction-control {
    display: flex;
    gap: 5px;
    align-items: center;
    max-width: 100%;
}

.mobile-photo-info .direction-btn {
    padding: 6px 10px;
    font-size: 14px;
}

.mobile-photo-info h3 {
    font-size: 16px;
}

@media (max-width: 768px) {
    html {
        position: fixed;
        overflow: hidden;
        width: 100%;
        height: 100%;
    }

    body {
        overflow: hidden;
        height: 100vh;
        height: 100dvh; /* iOS Safari対応 - 動的ビューポート高さ */
        position: fixed;
        width: 100%;
    }

    #main-container {
        flex-direction: column;
        height: 100vh;
        height: 100dvh; /* iOS Safari対応 */
        min-height: 100vh;
        min-height: 100dvh;
        overflow: hidden;
    }

    /* PC版コントロールを非表示、モバイル版を表示 */
    .pc-controls {
        display: none !important;
    }

    .mobile-controls {
        display: flex !important;
        gap: 10px;
        align-items: center;
    }

    /* モバイル版ヘッダー */
    #controls {
        justify-content: flex-end;
    }

    /* 写真情報・写真表示セクションを非表示 */
    #left-section {
        display: none !important;
    }

    /* メインレイアウトを縦並びに */
    #top-section {
        flex-direction: column;
        height: auto;
        flex: none;
    }

    /* サムネイルを上、地図を下に配置 */
    #thumbnails-panel {
        order: -1; /* サムネイルを最初に */
        height: 95px; /* サムネイル画像のサイズに合わせる */
        min-height: 95px;
        max-height: 95px;
        flex-shrink: 0;
        margin: 0; /* 余白をすべて削除 */
        padding: 0; /* パディングも削除 */
        overflow: hidden;
        width: 100vw; /* 画面いっぱいに */
        margin-left: calc(-1 * var(--container-padding, 0px)); /* コンテナのパディング分を相殺 */
        margin-right: calc(-1 * var(--container-padding, 0px));
        position: relative; /* ボタンの位置決め用 */
    }

    /* サムネイルナビゲーションボタン */
    .thumbnail-nav-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 30px;
        height: 60px;
        background-color: rgba(0, 0, 0, 0.5);
        color: white;
        border: none;
        font-size: 30px;
        cursor: pointer;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        transition: background-color 0.3s;
    }

    .thumbnail-nav-btn:active {
        background-color: rgba(0, 0, 0, 0.7);
    }

    .thumbnail-prev-btn {
        left: 0;
        border-radius: 0 4px 4px 0;
        margin-left: calc(var(--container-padding, 0px));
    }

    .thumbnail-next-btn {
        right: 0;
        border-radius: 4px 0 0 4px;
        margin-right: calc(var(--container-padding, 0px));
    }

    #top-section {
        order: 0; /* 地図を後に */
        border-bottom: none !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    /* モバイルでサムネイルを正方形に */
    .thumbnail-item {
        width: 85px !important;
        height: 85px !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .thumbnail-item .thumbnail-image-container {
        width: 85px !important;
        height: 85px !important;
        min-height: 85px !important;
        flex-shrink: 0 !important;
        position: relative !important;
        overflow: hidden !important;
    }

    .thumbnail-item .thumbnail-image {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
    }

    .thumbnail-item .thumbnail-info {
        display: none !important; /* 正方形表示時は情報を非表示 */
    }

    .thumbnail-name {
        display: none !important; /* 正方形表示時は名前を非表示 */
    }

    /* モバイル用の＋ボタンサイズ調整 */
    .add-photo-button {
        width: 85px !important;
        height: 85px !important;
        padding: 2px !important;
    }

    .add-photo-icon {
        font-size: 50px !important;
    }

    /* thumbnails-listの高さをサムネイルサイズに合わせる */
    #thumbnails-list {
        height: 95px !important; /* サムネイル画像のサイズに固定 */
        min-height: 95px !important;
        max-height: 95px !important;
        align-items: flex-start !important;
        gap: 5px !important; /* 隙間を小さく */
        padding: 0 35px !important; /* 左右にボタンスペース確保 */
        overflow-x: auto !important; /* 横スクロール可能 */
        overflow-y: hidden !important;
        scroll-behavior: smooth; /* スムーズスクロール */
        -webkit-overflow-scrolling: touch; /* iOS用スムーズスクロール */
        scrollbar-width: none; /* Firefox用スクロールバー非表示 */
        -ms-overflow-style: none; /* IE/Edge用スクロールバー非表示 */
    }

    /* Webkit系ブラウザ用スクロールバー非表示 */
    #thumbnails-list::-webkit-scrollbar {
        display: none;
    }

    #map-section {
        width: 100%;
        height: 60vh;
        min-height: 400px;
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    #map {
        height: 100% !important;
    }
}


#controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex: 1;
    justify-content: flex-end;
}

#controls button {
    padding: 6px 12px;
    border: 2px solid #ffffff;
    border-radius: 3px;
    background: transparent;
    color: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#controls button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #ffffff;
}

#controls button:active {
    transform: scale(0.98);
}

#printLayoutBtn {
    background: transparent;
    border-color: #ff6b6b;
    color: #ff6b6b;
}

#printLayoutBtn:hover {
    background: rgba(255, 107, 107, 0.15);
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* Dropdown menu styles */
.dropdown-container {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #2a2a2a;
    border: 2px solid #ffffff;
    border-radius: 3px;
    margin-top: 5px;
    min-width: 200px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 200; /* レイアウトツールバーより上に表示 */
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu button {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-bottom: 1px solid #444;
    background: transparent;
    color: white;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: background-color 0.2s ease;
}

.dropdown-menu button:last-child {
    border-bottom: none;
}

.dropdown-menu button:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

@media (max-width: 768px) {
    #controls {
        padding: 10px;
        gap: 10px;
    }

    #controls label {
        width: 100%;
        margin-bottom: 5px;
        font-size: 14px;
    }

    #info {
        width: 100%;
        font-size: 12px;
        margin-top: 5px;
        order: 10;
    }

    /* モバイル版情報ドロップダウンメニューの修正 */
    .dropdown-menu {
        min-width: 180px;
        max-width: 250px;
        right: 0; /* 右端に配置 */
        left: auto; /* 左からの配置を解除 */
        white-space: normal; /* テキストを折り返す */
        word-wrap: break-word;
    }

    .dropdown-menu a,
    .dropdown-menu button {
        padding: 8px 12px;
        font-size: 13px;
        white-space: normal;
        word-wrap: break-word;
        line-height: 1.4;
    }
}

#fileInput {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 4px;
}

#clearBtn, #exportPdfBtn {
    background-color: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

#downloadBtn {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

#downloadBtn:hover {
    background-color: #1976d2;
}

#exportBtn {
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

#exportBtn:hover {
    background-color: #45a049;
}

#importBtn {
    background-color: #ff9800;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

#importBtn:hover {
    background-color: #f57c00;
}

#cloudSaveBtn, #cloudSavePcBtn {
    background-color: #9c27b0;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

#cloudSaveBtn:hover, #cloudSavePcBtn:hover {
    background-color: #7b1fa2;
}

#cloudLoadBtn {
    background-color: #00bcd4;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

#cloudLoadBtn:hover {
    background-color: #0097a7;
}

#serverUploadBtn {
    background-color: #3f51b5;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

#serverUploadBtn:hover {
    background-color: #303f9f;
}

#serverDownloadBtn {
    background-color: #009688;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

#serverDownloadBtn:hover {
    background-color: #00796b;
}

/* モバイル/PC専用表示 */
.mobile-only {
    display: none;
}

.pc-only {
    display: inline-block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: inline-block;
    }
    .pc-only {
        display: none;
    }

    /* モバイルで不要なボタンと制限メッセージを非表示 */
    #downloadBtn,
    #exportBtn,
    #importBtn,
    #printLayoutBtn,
    #mobileLimitation {
        display: none;
    }
}


#printLayoutBtn {
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

#clearBtn:hover {
    background-color: #ff5252;
}

#printLayoutBtn:hover {
    background-color: #45a049;
}

#info {
    color: #666;
    font-size: 14px;
}

#thumbnails-panel {
    width: 100%;
    height: 25%;
    background-color: #f9f9f9;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
    white-space: nowrap;
    border-top: 2px solid #ddd;
}

#thumbnails-list {
    display: flex;
    gap: 10px;
    height: 100%;
}

.add-photo-button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background-color: #f0f0f0;
    border: 2px dashed #007bff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 180px;
    height: calc(100% - 16px);
    flex-shrink: 0;
}

.add-photo-button:hover {
    background-color: #e3f2fd;
    border-color: #0056b3;
    transform: scale(1.02);
}

.add-photo-icon {
    font-size: 80px;
    color: #007bff;
    font-weight: 300;
    line-height: 1;
}

@media (max-width: 768px) {
    /* thumbnails-panelの高さは上部の別のメディアクエリで90pxに設定済み */
    /* この重複定義をコメントアウト */
    /*
    #thumbnails-panel {
        width: 100%;
        height: 40vh;
        border-right: none;
        border-bottom: 2px solid #ddd;
        padding: 10px;
    }
    */
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    z-index: 1;
}

@media (max-width: 768px) {
    #map {
        height: 60vh;
        flex: none;
    }
}

/* マーカーのクリック判定を厳密にする */
.leaflet-marker-icon {
    pointer-events: none !important;
}

.leaflet-marker-icon > * {
    pointer-events: auto !important;
}

.leaflet-marker-icon svg,
.leaflet-marker-icon circle,
.leaflet-marker-icon path {
    pointer-events: auto !important;
}

.thumbnail-item {
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: move;
    transition: transform 0.3s ease, opacity 0.3s ease;
    position: relative;
    width: 180px;
    height: calc(100% - 16px);
    flex-shrink: 0;
}

.thumbnail-item.sortable-ghost {
    opacity: 0.3;
    background-color: #e3f2fd;
}

.thumbnail-item.sortable-chosen {
    cursor: grabbing;
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1000;
}

.thumbnail-item.sortable-drag {
    opacity: 0.8;
}

.thumbnail-item.sortable-chosen {
    background-color: #e3f2fd;
}

.move-buttons {
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 10;
}

.move-up-btn, .move-down-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 3px;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.move-up-btn:hover, .move-down-btn:hover {
    background: #fff;
    border-color: #999;
}

.move-up-btn:active, .move-down-btn:active {
    background: #e3f2fd;
}

/* 写真テーブル表示用スタイル */
#photo-table-panel {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    height: calc(100vh - 120px);
    overflow: auto;
}

#photo-table-header {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    font-size: 16px;
}

#photo-table-container {
    height: calc(100vh - 120px);
    overflow-y: auto;
    border: 1px solid #ddd;
    margin: 10px;
}

#photo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

#photo-table th {
    background: #f5f5f5;
    font-weight: bold;
    text-align: left;
    white-space: nowrap;
    padding: 12px 8px;
    border: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 10;
}

#photo-table td {
    padding: 8px;
    border: 1px solid #ddd;
    vertical-align: middle;
}

#photo-table td input, #photo-table td select {
    border: none;
    background: transparent;
    font-size: 13px;
    width: 100%;
    padding: 4px;
    border-radius: 2px;
}

#photo-table td input:focus, #photo-table td select:focus {
    background: #e3f2fd;
    outline: 2px solid #007bff;
}

#photo-table tr:hover {
    background: #f8f9fa;
}

#photo-table td img {
    width: 120px !important;
    height: 120px !important;
    object-fit: cover !important;
}


.thumbnail-item .thumbnail-image-container {
    margin: 0;
}

@media (max-width: 768px) {
    .thumbnail-item {
        flex-direction: row;
        padding: 8px;
        margin-bottom: 10px;
    }

    .thumbnail-image {
        width: 80px;
        height: 80px;
    }

    .thumbnail-info {
        flex: 1;
        min-width: 0;
    }

    .thumbnail-name {
        font-size: 11px;
    }

    .thumbnail-location {
        font-size: 10px;
        line-height: 1.2;
    }

    .photo-number {
        width: 24px;
        height: 24px;
        font-size: 11px;
        top: -4px;
        left: -4px;
    }

    .photo-select-checkbox {
        width: 14px;
        height: 14px;
        top: 6px;
        left: 30px;
    }

}

.thumbnail-item:hover {
    background-color: #f0f0f0;
}

.thumbnail-item.active {
    background-color: #fff3e0;
    border: 2px solid #ff9800;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
    }
    50% {
        box-shadow: 0 6px 20px rgba(33, 150, 243, 0.6);
        transform: scale(1.03);
    }
    100% {
        box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
    }
}

.thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.thumbnail-info {
    width: 100%;
    text-align: left;
    padding: 5px 8px;
}

.thumbnail-name-display {
    width: 100%;
    text-align: left;
    font-size: 15px;
    font-weight: bold;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.thumbnail-name-input {
    width: 100%;
    text-align: center;
    font-size: 12px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-sizing: border-box;
    margin-bottom: 3px;
}

.thumbnail-remarks-input {
    width: 100%;
    text-align: center;
    font-size: 11px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-sizing: border-box;
    background-color: #f9f9f9;
}


.highlight-drop-zone {
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.6) !important;
    border: 2px solid #2196f3 !important;
    background-color: rgba(33, 150, 243, 0.1) !important;
    transition: all 0.2s ease;
}

#map.highlight-drop-zone {
    box-shadow: inset 0 0 15px rgba(33, 150, 243, 0.4);
}

.thumbnail-name-container {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
}

.photo-number-label {
    font-weight: bold;
    font-size: 14px;
    color: white;
    background-color: #2196f3;
    padding: 2px 8px;
    border-radius: 4px;
    min-width: fit-content;
    display: inline-block;
}

.thumbnail-name-input {
    font-weight: bold;
    font-size: 14px;
    padding: 3px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background-color: white;
    flex: 1;
    box-sizing: border-box;
}

.thumbnail-name-input:focus {
    outline: none;
    border-color: #2196f3;
    background-color: #f0f8ff;
}

.thumbnail-location {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.location-coords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 5px;
}

.location-coords > span {
    white-space: nowrap;
}

.direction-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.direction-btn {
    background-color: #2196f3;
    color: white;
    border: none;
    border-radius: 3px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.direction-btn:hover {
    background-color: #1976d2;
}

.direction-spin-control {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    vertical-align: middle;
}

.direction-spin-control .direction-input {
    width: 35px;
    margin: 0;
}

.pin-icon {
    font-size: 16px;
    color: #ff4444;
    cursor: grab;
    margin-left: 8px;
    user-select: none;
    transition: transform 0.2s;
}

.pin-icon:hover {
    transform: scale(1.2);
}

.pin-icon:active {
    cursor: grabbing;
}

.remove-btn {
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 5px;
}

.remove-btn:hover {
    background-color: #ff5252;
}

#thumbnails-header {
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

@media (max-width: 768px) {
    #thumbnails-header {
        font-size: 12px;
    }

    #thumbnails-header button {
        font-size: 10px !important;
        padding: 2px 4px !important;
        margin-right: 2px !important;
    }

    #thumbnails-header #selectedCount {
        font-size: 9px !important;
        margin-left: 4px !important;
    }
}

.photo-number {
    display: none;
}

/* 写真選択チェックボックス */
.photo-select-checkbox {
    position: absolute;
    top: 8px;
    left: 35px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    z-index: 20;
    accent-color: #2196f3;
}

.photo-select-checkbox:hover {
    transform: scale(1.1);
}


.thumbnail-image-container {
    position: relative;
    display: flex;
    transition: all 0.3s ease;
    width: 100%;
    height: 150px;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

/* 回転時もサイズを固定 */
.thumbnail-image-container.rotated-90,
.thumbnail-image-container.rotated-180,
.thumbnail-image-container.rotated-270 {
    width: 100%;
    height: 150px;
}

/* サムネイル画像上の回転ボタン */
.thumbnail-rotate-left-btn,
.thumbnail-rotate-right-btn {
    position: absolute;
    top: 4px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(33, 150, 243, 0.9);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.thumbnail-rotate-left-btn {
    left: 4px;
}

.thumbnail-rotate-right-btn {
    right: 4px;
}

.thumbnail-rotate-left-btn:hover,
.thumbnail-rotate-right-btn:hover {
    background: rgba(25, 118, 210, 1);
    transform: scale(1.1);
}

.arrow-marker {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 30px solid #ff4444;
    position: relative;
}

.photo-popup {
    max-width: 930px;
    min-width: 450px;
    position: relative;
}

.popup-buttons {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
    z-index: 10000;
}

.popup-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.popup-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.rotation-spin-control {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    padding: 2px 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.rotation-value {
    min-width: 40px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    color: #333;
}

.rotate-decrease-btn,
.rotate-increase-btn {
    width: 24px;
    height: 24px;
    color: #666;
}

.rotate-decrease-btn:hover,
.rotate-increase-btn:hover {
    color: #2196f3;
    background: #e3f2fd;
}

.confirm-rotation-btn {
    color: #4caf50;
}

.confirm-rotation-btn:hover {
    background: #e8f5e8;
}

.thumbnail-confirm-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    background: rgba(76, 175, 80, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    z-index: 10;
}

.thumbnail-confirm-btn:hover {
    background: rgba(76, 175, 80, 1);
    transform: scale(1.1);
}

.close-btn {
    color: #2196f3;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.close-btn:hover {
    background: #e3f2fd !important;
}

.rotate-btn {
    color: #ff9800;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 2px solid #ff9800 !important;
}

.rotate-btn:hover {
    background: #fff3e0 !important;
    transform: scale(1.1);
}

.popup-title {
    margin-bottom: 10px;
    font-size: 14px;
    text-align: center;
}

.popup-image-container {
    width: 600px;
    height: 600px;
    max-width: 600px;
    max-height: 600px;
    overflow: hidden;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
}

.popup-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

.photo-popup img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* 動的ポップアップのLeaflet内部要素の幅を強制 */
.leaflet-popup {
    width: auto !important;
    max-width: 650px !important;
}

.leaflet-popup-content-wrapper {
    width: auto !important;
    max-width: 650px !important;
    min-width: 300px !important;
}

.leaflet-popup-content {
    width: auto !important;
    max-width: 650px !important;
    min-width: 300px !important;
    margin: 13px 19px !important;
}

.dynamic-popup .leaflet-popup-content-wrapper {
    width: auto !important;
    max-width: 650px !important;
}

.dynamic-popup .leaflet-popup-content {
    width: auto !important;
    max-width: 650px !important;
    margin: 13px 19px !important;
}

/* 全画面モーダル */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.fullscreen-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fullscreen-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.2s;
}

.fullscreen-close:hover {
    background: rgba(255, 255, 255, 1);
}

.fullscreen-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.fullscreen-info {
    margin-top: 15px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    text-align: center;
    color: #333;
}

.fullscreen-info h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
}

.fullscreen-info p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.font-size-selector {
    margin: 15px 0;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
}

.font-size-selector h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
}

.font-size-controls {
    display: flex;
    gap: 15px;
}

.font-size-controls label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: white;
    transition: all 0.2s;
}

.font-size-controls label:hover {
    background: #f0f0f0;
}

.font-size-controls input[type="radio"]:checked + span {
    font-weight: bold;
    color: #2196F3;
}

/* 文字サイズクラス（プレビューをさらに大きく調整） */
.font-size-small .print-photo-name {
    font-size: 1.4em !important;  /* さらに大きく */
}

.font-size-small .print-photo-coords {
    font-size: 1.2em !important;  /* さらに大きく */
}

.font-size-medium .print-photo-name {
    font-size: 1.7em !important;  /* より大きく */
}

.font-size-medium .print-photo-coords {
    font-size: 1.5em !important;  /* より大きく */
}

.font-size-large .print-photo-name {
    font-size: 2.0em !important;  /* 最大サイズ */
}

.font-size-large .print-photo-coords {
    font-size: 1.8em !important;  /* 最大サイズ */
}

/* モバイル表示時のポップアップ調整 */
@media (max-width: 768px) {
    .photo-popup {
        max-width: 95vw !important;
        min-width: 90vw !important;
        margin: 0 !important;
    }

    .photo-popup img {
        max-width: 100% !important;
        max-height: 50vh !important;
        width: 100% !important;
        height: auto !important;
    }

    .popup-buttons {
        top: 8px;
        right: 8px;
        gap: 8px;
    }

    .popup-btn {
        width: 40px;
        height: 40px;
        border-radius: 6px;
    }

    .popup-btn svg {
        width: 20px;
        height: 20px;
    }

    .photo-info {
        font-size: 14px;
        padding: 8px;
        margin-top: 8px;
    }

    /* 全画面モーダルのモバイル調整 */
    .fullscreen-content {
        max-width: 98vw;
        max-height: 98vh;
        padding: 0 10px;
    }

    .fullscreen-close {
        top: -50px;
        right: 10px;
        width: 45px;
        height: 45px;
        font-size: 28px;
    }

    .fullscreen-content img {
        max-height: 75vh;
    }

    .fullscreen-info {
        margin-top: 10px;
        padding: 8px 15px;
        font-size: 16px;
    }

    .fullscreen-info h3 {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .fullscreen-info p {
        font-size: 16px;
    }
}

.photo-info {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
    padding: 0 5px;
}


/* カスタムフィールド */
.custom-fields {
    margin-top: 10px;
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-top: 1px solid #eee;
}

@media (max-width: 768px) {
    .custom-fields {
        padding: 6px;
        margin-top: 8px;
    }

    .custom-field {
        margin-bottom: 3px;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .custom-field label {
        font-size: 9px;
        min-width: auto;
    }

    .custom-input, .custom-select {
        font-size: 9px;
        padding: 1px 3px;
        width: 100%;
        box-sizing: border-box;
    }

    .custom-other-input {
        font-size: 9px;
        padding: 1px 3px;
        margin-left: 0;
        margin-top: 2px;
        width: 100%;
        box-sizing: border-box;
    }
}

.custom-field {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    gap: 5px;
}

.custom-field:last-child {
    margin-bottom: 0;
}

.custom-field label {
    font-size: 12px;
    font-weight: bold;
    min-width: 50px;
    color: #555;
}

.custom-input {
    flex: 1;
    padding: 3px 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    background-color: white;
}

.custom-input:focus {
    outline: none;
    border-color: #2196f3;
}

.custom-select {
    flex: 1;
    padding: 3px 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    background-color: white;
    cursor: pointer;
}

.custom-select:focus {
    outline: none;
    border-color: #2196f3;
}

.custom-other-input {
    flex: 1;
    padding: 3px 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    background-color: #fff8e1;
    margin-left: 5px;
    display: none;
}

.custom-other-input.show {
    display: block;
}


/* ドラッグアンドドロップスタイル */
.thumbnail-image-container[draggable="true"] {
    cursor: move;
    transition: opacity 0.2s;
}

.thumbnail-image-container[draggable="true"]:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.thumbnail-image-container[draggable="true"] .thumbnail-image {
    border: 2px dashed #4caf50;
}

@media (max-width: 768px) {
    .thumbnail-image-container[draggable="true"]:hover {
        transform: none;
    }
}

/* 画像モードスタイル */
#imageContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #f0f0f0;
    display: none;
    z-index: -1;
}

#imageContainer .image-controls-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 10px;
    align-items: center;
}

#imageContainer .image-controls-overlay label {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

/* PCでの完全画面表示 */
@media (min-width: 769px) {
    #imageContainer {
        height: 100%;
        max-height: 100%;
        overflow: hidden;
    }
}

#backgroundImageDisplay {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: crosshair;
}

.image-marker {
    position: absolute;
    z-index: 1000;
    pointer-events: auto;
    /* viewportベースの固定サイズ */
    width: 4vw;
    height: 4vw;
    min-width: 40px;
    min-height: 40px;
    max-width: 60px;
    max-height: 60px;
    /* マーカーの中心を正確に位置に合わせる */
    transform: translate(-50%, -50%) !important;
}

.image-marker svg {
    width: 100% !important;
    height: 100% !important;
}

.image-marker .direction-arrow {
    width: 100% !important;
    height: 100% !important;
}

/* 矢印の部分のみカーソルを変更 */
.arrow-path {
    cursor: grab;
    user-select: none;
}

.arrow-path:active {
    cursor: grabbing;
}

/* 青い円の部分はデフォルトのカーソル（マーカードラッグ用） */
.marker-center {
    cursor: move;
}

/* トグルスイッチ（印刷する）のスタイル */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    transition: background-color 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
    background-color: #2196f3;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 13px;
    color: #333;
}

/* スイッチボタンのスタイル */
.view-mode-buttons {
    display: flex;
    gap: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 3px;
    border-radius: 6px;
    margin-left: 8px;
    flex-shrink: 0;
}

.view-mode-btn {
    background-color: transparent;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
}

.view-mode-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.view-mode-btn.active {
    background-color: #ff9800;
    border: 3px solid #ff9800;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    outline: 2px solid #ff9800;
    outline-offset: 1px;
}

#clearImageBtn {
    background-color: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
}

#clearImageBtn:hover {
    background-color: #ff5252;
}

/* 方向入力フィールド */
.direction-input {
    width: 35px;
    font-size: 12px;
    padding: 2px 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-align: center;
    background-color: #fff;
    transition: border-color 0.2s;
    appearance: textfield; /* スピンボタンを非表示 */
}

.direction-input:focus {
    outline: none;
    border-color: #2196f3;
    background-color: #f0f8ff;
}

.direction-input:hover {
    border-color: #999;
}

/* スピンボタンを非表示 */
.direction-input::-webkit-outer-spin-button,
.direction-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

@media (max-width: 768px) {
    .direction-input {
        width: 40px;
        font-size: 9px;
        padding: 1px 2px;
    }

    .direction-input::-webkit-outer-spin-button,
    .direction-input::-webkit-inner-spin-button {
        height: 16px;
    }
}

/* フィールド選択 */
.field-selector {
    margin-bottom: 15px;
    padding: 15px;
    background-color: #f0f8ff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.field-selector h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
}

.field-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

@media (max-width: 768px) {
    .field-checkboxes {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .field-checkbox {
        padding: 3px;
    }

    .field-checkbox span {
        font-size: 11px;
    }

    .print-modal-title {
        font-size: 18px;
    }

    .field-selector h4 {
        font-size: 13px;
    }

    .print-actions {
        flex-direction: column;
        gap: 8px;
    }

    .print-btn, .preview-btn {
        padding: 10px 16px;
        font-size: 14px;
        width: 100%;
    }

    /* 業界選択モーダル専用のスタイル調整 */
    #industryPresetModal .print-modal-content {
        display: flex;
        flex-direction: column;
        max-height: 90vh;
    }

    #industryPresetModal .industry-grid {
        flex: 1;
        overflow-y: auto;
        margin-bottom: 15px;
    }

    #industryPresetModal .print-actions {
        position: sticky;
        bottom: 0;
        background: #fefefe;
        padding-top: 15px;
        border-top: 1px solid #e0e0e0;
        margin-top: auto;
    }
}

.field-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.field-checkbox:hover {
    background-color: rgba(33, 150, 243, 0.1);
}

.field-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.field-checkbox span {
    font-size: 12px;
    color: #555;
    cursor: pointer;
}

/* 印刷レイアウトモーダル */
.print-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.print-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: none;
    border-radius: 8px;
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .print-modal-content {
        margin: 2% auto;
        padding: 15px;
        width: 95%;
        max-height: 95vh;
        border-radius: 4px;
    }
}

.print-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.print-modal-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
}

.close-btn:hover {
    color: #000;
}

.unplaced-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 20px;
}

.unplaced-photo-item {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.unplaced-photo-item:hover {
    border-color: #007cba;
    transform: scale(1.05);
}

.unplaced-photo-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

.unplaced-photo-item .photo-name {
    padding: 5px;
    font-size: 11px;
    text-align: center;
    background-color: #f5f5f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layout-controls {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 6px;
}

.layout-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.layout-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    background-color: white;
    transition: all 0.2s;
}

.layout-option:hover {
    border-color: #2196f3;
    background-color: #f0f8ff;
}

.layout-option.selected {
    border-color: #2196f3;
    background-color: #e3f2fd;
}

.layout-option input {
    margin: 0;
}

.print-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.print-btn, .preview-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.print-btn {
    background-color: #4caf50;
    color: white;
}

.print-btn:hover {
    background-color: #45a049;
}

.preview-btn {
    background-color: #2196f3;
    color: white;
}

.preview-btn:hover {
    background-color: #1976d2;
}

/* A4印刷レイアウト */
.print-page {
    width: 297mm;
    height: 210mm;
    margin: 0 auto 20px;
    background: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    padding: 10mm;
    box-sizing: border-box;
    page-break-after: always;
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
    -webkit-print-color-adjust: exact;
    color-adjust: exact;
}

.print-page.portrait {
    width: 210mm;
    height: 297mm;
}

.print-grid {
    display: grid;
    gap: 5mm;
    width: 100%;
    height: 100%;
}

.print-grid.layout-1x1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

/* 1×1レイアウトで情報エリアをサブ写真と分割 */
.print-grid.layout-1x1 .print-photo-info-area {
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding: 4px;
    background: #f9f9f9;
    border-top: 1px solid #ddd;
}

.print-grid.layout-1x1 .print-photo-info {
    flex: 1;
    min-width: 0;
}

.print-grid.layout-1x1 .print-sub-photo {
    flex: 0 0 auto;
    width: 80px;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.print-grid.layout-1x1 .print-sub-photo-image {
    width: 80px;
    height: 60px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 3px;
    border: 1px solid #ccc;
}

.print-grid.layout-2x2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* 2×2レイアウトで情報エリアをサブ写真と分割 */
.print-grid.layout-2x2 .print-photo-info-area {
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding: 4px;
    background: #f9f9f9;
    border-top: 1px solid #ddd;
}

.print-grid.layout-2x2 .print-photo-info {
    flex: 1;
    min-width: 0;
}

.print-grid.layout-2x2 .print-sub-photo {
    flex: 0 0 auto;
    width: 60px;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.print-grid.layout-2x2 .print-sub-photo-image {
    width: 60px;
    height: 40px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 3px;
    border: 1px solid #ccc;
}

.print-grid.layout-3x1 {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, 1fr);
}

.print-grid.layout-3x1 .print-photo-item {
    display: flex;
    flex-direction: row;
}

.print-grid.layout-3x1 .print-photo-main {
    flex: 0 0 66.67%; /* 固定で2/3の幅 */
    max-width: 66.67%;
    min-width: 66.67%;
    display: flex;
    flex-direction: column;
}

.print-grid.layout-3x1 .print-photo-image {
    width: 100%;
    height: 100%;
    min-height: 150px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

/* 3×1レイアウト専用の右側情報エリア */
.print-grid.layout-3x1 .print-info-sub-area {
    flex: 0 0 33.33%; /* 固定で1/3の幅 */
    max-width: 33.33%;
    min-width: 33.33%;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #ddd;
    background: #f9f9f9;
    overflow: hidden;
}

.print-grid.layout-3x1 .print-photo-info {
    flex: 1;
    padding: 6px;
    border-bottom: 1px solid #ddd;
}

.print-grid.layout-3x1 .print-photo-name {
    font-size: 11px;
    margin-bottom: 4px;
    font-weight: bold;
    line-height: 1.2;
}

.print-grid.layout-3x1 .print-photo-coords {
    font-size: 9px;
    line-height: 1.3;
}

.print-grid.layout-3x1 .print-sub-photo {
    flex: 1;
    height: auto;
    padding: 6px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-top: 4px;
    overflow: hidden;
}

.print-grid.layout-3x1 .print-sub-photo-image {
    width: 100%;
    height: 100px;
    flex-shrink: 0;
}

.print-grid.layout-3x1 .print-sub-photo-label {
    font-size: 10px;
    text-align: center;
    color: #666;
    font-weight: bold;
}

.print-grid.layout-3x2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, 1fr);
}

/* 3×2レイアウトで写真の高さを統一 */
.print-grid.layout-3x2 .print-photo-item {
    display: flex;
    flex-direction: column;
}

.print-grid.layout-3x2 .print-photo-image {
    flex: 0 0 auto;
    height: 240px; /* 固定の高さで統一 */
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.print-grid.layout-3x2 .print-photo-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* 3×2レイアウトで情報エリアをサブ写真と分割 */
.print-grid.layout-3x2 .print-photo-info-area {
    flex: 0 0 auto;
    max-height: 60px; /* 情報エリアの高さを制限 */
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding: 4px;
    background: #f5f5f5 !important;
    border-top: 1px solid #ddd;
    overflow: hidden;
}

.print-grid.layout-3x2 .print-photo-info {
    flex: 1;
    min-width: 0;
}

.print-grid.layout-3x2 .print-sub-photo {
    flex: 0 0 auto;
    width: 60px;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.print-grid.layout-3x2 .print-sub-photo-image {
    width: 60px;
    height: 40px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 3px;
    border: 1px solid #ccc;
}


.print-photo-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: white;
    display: flex;
    flex-direction: column;
    font-size: 10pt;
    line-height: 1.2;
}

.print-photo-info {
    font-size: 9pt;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.print-photo-name {
    font-size: 10pt;
    font-weight: bold;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 5px;
}

.print-photo-coords {
    font-size: 8pt;
    line-height: 1.0;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 地図印刷専用スタイル */
.map-print-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.map-print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10mm;
    border-bottom: 2px solid #333;
    margin-bottom: 5mm;
}

.map-print-header h2 {
    margin: 0;
    font-size: 18pt;
    color: #333;
}

.print-info {
    font-size: 10pt;
    color: #666;
}

.map-print-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-print-image {
    max-width: 100%;
    max-height: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    object-fit: contain;
}

/* 背景画像+マーカー矢印のみ印刷専用スタイル */
.map-markers-print-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.map-markers-print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8mm;
    border-bottom: 2px solid #333;
    margin-bottom: 4mm;
}

.map-markers-print-header h2 {
    margin: 0;
    font-size: 16pt;
    color: #333;
}

.map-markers-print-content {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-markers-background {
    width: 100%;
    height: 100%;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid #ddd;
}

.map-markers-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.print-photo-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.print-sub-photo {
    height: 100px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
}

.print-sub-photo-image {
    width: 80px;
    height: 80px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 3px;
    border: 1px solid #ccc;
    flex-shrink: 0;
}

.print-sub-photo-label {
    font-size: 10px;
    color: #666;
    font-weight: bold;
}

.print-photo-image {
    flex: 1;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 0;
}

.print-photo-info {
    padding: 3mm;
    font-size: 10px;
    line-height: 1.2;
    background: white;
    border-top: 1px solid #eee;
}

.print-photo-name {
    font-weight: bold;
    margin-bottom: 2px;
}

.print-photo-coords {
    color: #666;
    font-size: 8px;
}

/* 印刷時のスタイル */
@media print {
    body * {
        visibility: hidden;
    }

    .print-page, .print-page * {
        visibility: visible;
    }

    .print-page {
        position: absolute;
        left: 0;
        top: 0;
        margin: 0;
        box-shadow: none;
    }

    @page {
        margin: 0;
        size: A4 landscape;
    }

    @page :first {
        size: A4 landscape;
    }

    .print-page.portrait {
        size: A4 portrait;
    }

    .print-page.portrait ~ .print-page.portrait {
        page-break-before: always;
    }
}

/* ヘッダー */
.app-header {
    background-color: #2a2a2a;
    color: white;
    padding: 8px 15px;
    border-bottom: 2px solid #444444;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    position: relative;
}

.title-container {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-logo {
    height: 28px;
    width: auto;
    object-fit: contain;
}

.title-container h1 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

.version-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 5px;
    padding: 6px 12px;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.title-container:hover .version-tooltip {
    display: block;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: white;
}

.header-info a {
    color: white;
    text-decoration: underline;
}

.header-info .company-name {
    font-size: 20px;
    font-weight: bold;
    text-decoration: none;
}

.header-info .survey-link {
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    background-color: #ff9800;
    color: white;
    text-decoration: none;
}


/* 矢印表示切り替えコントロール */
#arrow-toggle-control {
    position: absolute;
    bottom: 30px;
    right: 5px;
    z-index: 50; /* 他の要素の下に配置 */
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
}

#arrow-toggle-control input[type="checkbox"] {
    margin: 0;
    transform: scale(1.1);
}

#arrow-toggle-control label {
    margin: 0;
    cursor: pointer;
    color: #333;
}

/* Leaflet attribution の表示を確実にする */
.leaflet-control-attribution {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
    font-size: 12px !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    border: 1px solid #ccc !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
    z-index: 1000 !important;
    position: absolute !important;
    bottom: 0 !important;
    right: 0 !important;
    margin: 0 !important;
}

.leaflet-control-attribution a {
    color: #0078a8 !important;
    text-decoration: none !important;
}

.leaflet-control-attribution a:hover {
    text-decoration: underline !important;
}

/* 方位マーク（コンパス）のスタイル */
.compass-control {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    cursor: default;
}

.compass-container {
    padding: 8px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compass-face {
    position: relative;
    width: 48px;
    height: 48px;
    border: 2px solid #2196f3;
    border-radius: 50%;
    background: radial-gradient(circle, #ffffff 30%, #f0f8ff 100%);
}

.compass-needle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 32px;
    margin-top: -16px;
}

.needle-north {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 16px;
    background: #d32f2f;
    border-radius: 2px 2px 0 0;
}

.needle-south {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 2px;
    height: 16px;
    background: #666;
    border-radius: 0 0 2px 2px;
}

.compass-direction {
    position: absolute;
    font-size: 10px;
    font-weight: bold;
    color: #1976d2;
}

.compass-n {
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    color: #d32f2f;
    font-weight: 900;
}

.compass-e {
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

.compass-s {
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
}

.compass-w {
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
}

/* カスタムattribution */
#custom-attribution {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 3px;
    border: 1px solid #ccc;
    z-index: 10000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

#custom-attribution a {
    color: #0078a8;
    text-decoration: none;
}

#custom-attribution a:hover {
    text-decoration: underline;
}

/* 地図コンテナの位置設定は上部で定義済み（position: absolute） */

/* HTML直接追加のattribution - 地図内の右下に配置 */
#map-attribution {
    position: absolute !important;
    bottom: 20px !important;
    right: 10px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
    font-size: 11px !important;
    padding: 3px 6px !important;
    border-radius: 3px !important;
    border: 1px solid #ccc !important;
    z-index: 99999 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
    font-family: Arial, sans-serif !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: auto !important;
    height: auto !important;
}

#map-attribution a {
    color: #0078a8;
    text-decoration: none;
}

#map-attribution a:hover {
    text-decoration: underline;
}

/* モバイル専用サムネイル表示枠 */
.mobile-thumbnail-panel {
    display: none;
    background: white;
    border-top: 2px solid #2196f3;
    padding: 15px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1000;
    width: 100%;
}

.mobile-thumbnail-panel.show {
    display: block;
}

.mobile-thumbnail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.mobile-thumbnail-header span {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.mobile-thumbnail-close {
    background: rgba(255, 255, 255, 0.9);
    color: #2196f3;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.mobile-thumbnail-close:hover {
    background: #e3f2fd;
}

.mobile-thumbnail-content {
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: flex-start;
}

.mobile-thumbnail-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.mobile-thumbnail-info {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 15px;
    font-size: 12px;
    color: #333;
    line-height: 1.3;
}

.mobile-thumbnail-info strong {
    color: #2196f3;
}

.mobile-basic-info {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-custom-info {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* モバイルでのみ表示 */
@media (max-width: 768px) {
    .mobile-thumbnail-panel {
        display: none;
    }

    .mobile-thumbnail-panel.show {
        display: block;
    }
}

@media (min-width: 769px) {
    .mobile-thumbnail-panel {
        display: none !important;
    }
}

/* 業界選択モーダル */
.industry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.industry-option {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.industry-option:hover {
    border-color: #2196f3;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
    transform: translateY(-2px);
}

.industry-option.selected {
    border-color: #2196f3;
    background: #f0f8ff;
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.25);
}

.industry-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.industry-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.industry-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.industry-current {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #4caf50;
    color: white;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: bold;
}

/* アンケートリンクのスタイル */
.survey-link {
    background-color: #ff9800 !important;
    color: white !important;
    text-decoration: none !important;
    transition: all 0.3s ease;
}

.survey-link:hover {
    background-color: #f57c00 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

@media (max-width: 768px) {
    .industry-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .industry-option {
        padding: 15px;
        min-height: 120px;
    }

    .industry-icon {
        font-size: 28px;
        margin-bottom: 8px;
    }

    .industry-title {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .industry-desc {
        font-size: 13px;
    }

    .app-header {
        padding: 5px 8px; /* 2割減: 6px → 5px */
        /* iOS safe area対応 */
        padding-top: max(5px, env(safe-area-inset-top));
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }

    .app-header h1 {
        font-size: 14px; /* サイズも少し小さく */
    }

    .app-logo {
        height: 24px; /* モバイルでは少し小さく */
    }

    .app-footer {
        display: none; /* スマホ版はフッターを非表示 */
    }


    /* スマホ版制限メッセージ */
    .mobile-limitation {
        background-color: #fff3cd;
        border: 1px solid #ffeaa7;
        color: #856404;
        padding: 8px 12px;
        border-radius: 4px;
        font-size: 12px;
        margin: 5px 0;
        display: none;
    }

    .mobile-limitation.show {
        display: block;
    }
}

/* レイアウト選択モーダル */
.layout-orientation-section {
    margin-bottom: 20px;
}

.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.layout-preview-card {
    cursor: pointer;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s ease;
    background-color: white;
}

.layout-preview-card:hover {
    border-color: #4CAF50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-3px);
}

.layout-preview-card.selected {
    border-color: #4CAF50;
    background-color: #e8f5e9;
}

.layout-preview {
    width: 100%;
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 10px;
    padding: 10px;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.layout-preview.portrait {
    aspect-ratio: 210 / 297; /* A4縦の比率 */
}

.layout-preview.landscape {
    aspect-ratio: 297 / 210; /* A4横の比率 */
}

.layout-grid-container {
    display: grid;
    gap: 8px;
    width: 100%;
    height: 100%;
}

.layout-photo-box {
    background-color: white;
    border: 2px dashed #999;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
}

.layout-photo-box::after {
    content: '📷';
    font-size: 20px;
    opacity: 0.3;
}

.layout-description-box {
    background-color: #fff9e6;
    border: 1px solid #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
}

.layout-description-box::after {
    content: '説明';
    font-size: 11px;
    color: #666;
}

.layout-label {
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* モバイル版レイアウト選択モーダル */
@media (max-width: 768px) {
    .layout-orientation-section {
        margin-bottom: 15px;
    }

    .layout-orientation-section h3 {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }

    .layout-grid {
        grid-template-columns: repeat(2, 1fr); /* 2列表示 */
        gap: 10px;
        margin-bottom: 10px;
    }

    .layout-preview-card {
        padding: 8px;
        border-width: 1px;
    }

    .layout-preview {
        padding: 6px;
        margin-bottom: 6px;
    }

    .layout-photo-box::after {
        font-size: 14px;
    }

    .layout-description-box::after {
        font-size: 9px;
    }

    .layout-label {
        font-size: 11px;
    }

    /* モーダルコンテンツのパディング調整 */
    #layoutSelectionModal .print-modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }

    #layoutSelectionModal .print-modal-content > div {
        padding: 10px !important;
    }
}

/* レイアウト表示（地図セクション内） */
#layout-display-container {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: white;
    z-index: 1000;
    overflow: auto;
    padding: 20px;
}

#layout-display-container.active {
    display: block;
}

.layout-display {
    max-width: 210mm;
    margin: 0 auto;
    background-color: white;
    box-shadow: none; /* ページの外枠を非表示 */
    padding: 15mm;
}

.layout-display.portrait {
    width: 210mm;
    min-height: 297mm;
}

.layout-display.landscape {
    width: 297mm;
    min-height: 210mm;
}

/* モバイル用レイアウト調整 */
@media (max-width: 768px) {
    #layout-display-container {
        padding: 10px;
    }

    .layout-display {
        max-width: 100%;
        width: 100% !important;
        min-height: auto;
        padding: 10px;
        transform: scale(1);
        transform-origin: top center;
    }

    .layout-display.portrait {
        width: 100% !important;
        min-height: auto;
    }

    .layout-display.landscape {
        width: 100% !important;
        min-height: auto;
    }

    .layout-drop-zone img {
        min-width: 100%;
        min-height: 100%;
        width: 100%;
        height: 100%;
        object-fit: contain; /* スマホ版で写真が横長にならないように */
    }

    /* モバイル版でも写真編集機能を有効化 */
    .layout-drop-zone.edit-mode img {
        object-fit: contain;
    }

    /* モバイル用の回転ボタンサイズ調整 */
    .photo-rotate-btn {
        padding: 10px 15px;
        font-size: 16px;
        touch-action: manipulation;
    }

    /* モバイル用のリサイズハンドルを大きく */
    .photo-resize-handle {
        width: 24px;
        height: 24px;
        touch-action: manipulation;
    }
}

.layout-display-grid {
    display: grid;
    gap: 10px;
    height: 100%;
}

.layout-drop-zone {
    background-color: #f5f5f5;
    border: 2px solid #000000;
    border-radius: 0; /* 角を直角に */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    width: 100%;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.layout-drop-zone:hover {
    border-color: #000000;
    background-color: #f5f5f5;
}

.layout-drop-zone.drag-over {
    border-color: #000000;
    background-color: #e0e0e0;
    border-width: 3px;
}

.layout-drop-zone.has-photo {
    border-style: solid;
    border-color: #000000;
    background-color: white;
}

.layout-drop-zone-placeholder {
    color: #999;
    font-size: 48px;
    pointer-events: none;
    font-weight: 300;
    line-height: 1;
}

.layout-drop-zone {
    overflow: hidden; /* 枠からはみ出た部分をトリミング */
}

.layout-drop-zone img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: contain; /* アスペクト比を保持 */
    user-select: none;
    pointer-events: none;
}

/* 編集モード時 */
.layout-drop-zone.edit-mode {
    overflow: visible;
    z-index: 1000;
}

.layout-drop-zone.edit-mode img {
    cursor: move;
    pointer-events: auto;
    min-width: initial;
    min-height: initial;
    max-width: none;
    max-height: none;
    z-index: 1002;
}

/* トリミング枠のオーバーレイ */
.crop-frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1003;
}

.crop-frame-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    border: 2px solid #2196F3;
}

/* 回転ボタン */
.photo-rotate-controls {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 10px;
    z-index: 1004;
}

.layout-drop-zone.edit-mode .photo-rotate-controls {
    display: flex;
}

.photo-rotate-btn {
    background: rgba(33, 150, 243, 0.95);
    color: white;
    border: 2px solid white;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: background 0.2s;
    white-space: nowrap;
    font-weight: bold;
}

.photo-rotate-btn:hover {
    background: rgba(33, 150, 243, 1);
}

/* リサイズハンドル - 写真の角に配置 */
.photo-resize-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #2196F3;
    border: 3px solid white;
    border-radius: 50%;
    z-index: 1004;
    display: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.layout-drop-zone.edit-mode .photo-resize-handle {
    display: block;
}

.photo-resize-handle.top-left {
    cursor: nwse-resize;
}

.photo-resize-handle.top-right {
    cursor: nesw-resize;
}

.photo-resize-handle.bottom-left {
    cursor: nesw-resize;
}

.photo-resize-handle.bottom-right {
    cursor: nwse-resize;
}

.layout-drop-zone-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(244, 67, 54, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.layout-drop-zone.has-photo:hover .layout-drop-zone-remove {
    display: flex;
}

.layout-drop-zone.edit-mode .layout-drop-zone-remove {
    display: none !important;
}

/* レイアウトゾーン選択メニュー */
.layout-zone-menu {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    min-width: 150px;
}

.layout-zone-menu-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
}

.layout-zone-menu-item:hover {
    background-color: #f5f5f5;
}

.layout-zone-menu-item:active {
    background-color: #e0e0e0;
}

/* 写真選択モーダル */
.layout-photo-select-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.layout-photo-select-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.layout-photo-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
}

.layout-photo-select-header h3 {
    margin: 0;
    font-size: 18px;
}

.layout-photo-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 20px;
    overflow-y: auto;
}

.layout-photo-select-item {
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.2s;
}

.layout-photo-select-item:hover {
    border-color: #ff9800;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.layout-photo-select-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.layout-photo-select-name {
    padding: 8px;
    font-size: 12px;
    text-align: center;
    background-color: #f5f5f5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* モバイル用の写真選択モーダル調整 */
@media (max-width: 768px) {
    .layout-photo-select-content {
        width: 95%;
        max-height: 90vh;
    }

    .layout-photo-select-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
        padding: 15px;
    }

    .layout-photo-select-item img {
        height: 80px;
    }

    .layout-photo-select-name {
        font-size: 10px;
        padding: 5px;
    }

    .layout-photo-select-header h3 {
        font-size: 16px;
    }
}

.layout-description-area {
    background-color: white; /* 背景を白に */
    border: 1px solid #000000;
    border-radius: 0; /* 角を直角に */
    padding: 10px;
    min-height: 50px;
}

.layout-description-area textarea {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    resize: none;
    font-size: 12px;
    font-family: inherit;
}

/* タイトルエリア */
.layout-title-area {
    background-color: transparent;
    border: none; /* 外枠を非表示 */
    border-radius: 4px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    min-height: 35px;
}

.layout-title-area input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: bold;
    font-family: inherit;
    text-align: center;
    line-height: 1.4;
    color: #000000; /* 黒 */
}

.layout-title-area input:focus {
    outline: none;
}

/* ページ番号エリア */
.layout-page-number {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none; /* 外枠を非表示 */
    border-radius: 4px;
    padding: 8px;
}

.layout-page-number span {
    font-size: 14px;
    font-weight: bold;
    color: #000000; /* 黒 */
}

/* 写真タイトルエリア */
.layout-photo-title-area {
    background-color: transparent; /* 背景なし */
    border: none; /* 枠なし */
    padding: 2px 10px 6px 10px; /* 下に余裕を持たせる */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 22px;
}

.layout-photo-title-area input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: bold;
    font-family: inherit;
    line-height: 1.6; /* 行間を広げる */
    text-align: center;
    color: #000000; /* 黒 */
}

.layout-photo-title-area input:focus {
    outline: none;
}

/* 写真とタイトルの重ね合わせ */
.layout-photo-with-title {
    position: relative;
    width: 100%;
}

.overlay-photo-title {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.overlay-photo-title input {
    border: none;
    background: transparent;
    font-size: 11px; /* 2回り小さく */
    font-weight: bold;
    min-width: 150px;
}

.overlay-photo-title input:focus {
    outline: none;
}

.layout-photo-with-title .layout-drop-zone {
    width: 100%;
    height: 100%;
}

/* ページナビゲーション */
.page-navigation {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 10px;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
}

.page-navigation button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* レイアウトツールバー */
.layout-toolbar {
    position: sticky;
    top: -20px;
    background-color: #d0d0d0;
    border-bottom: 1px solid #999;
    padding: 10px;
    margin: -20px -20px 20px -20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 101;
}

.layout-toolbar-controls {
    display: flex;
    gap: 5px;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.layout-toolbar button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    min-width: 36px;
}

.layout-toolbar button:hover:not(:disabled) {
    background-color: #f5f5f5;
    border-color: #999;
}

.layout-toolbar button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.layout-toolbar button.primary {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
    font-size: 14px;
    padding: 8px 16px;
}

.layout-toolbar button.primary:hover {
    background-color: #45a049;
}

/* レイアウト全画面表示ボタン */
.layout-fullscreen-btn {
    padding: 8px 12px;
    background-color: rgba(33, 150, 243, 0.9);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.layout-fullscreen-btn:hover {
    background-color: rgba(33, 150, 243, 1);
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.layout-fullscreen-btn:active {
    transform: scale(0.95);
}

/* 利用規約モーダル */
.terms-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

.terms-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    width: 90%;
    max-width: 800px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.terms-modal-header {
    background-color: #2196F3;
    color: white;
    padding: 20px;
    border-radius: 8px 8px 0 0;
}

.terms-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

.terms-modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.terms-text {
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: 14px;
    color: #333;
    margin-bottom: 20px;
    flex: 1;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 4px;
    background-color: #f9f9f9;
    max-height: 50vh;
}

.terms-agreement {
    margin-top: 15px;
    padding: 15px;
    background-color: #f0f7ff;
    border-radius: 4px;
    border: 2px solid #2196F3;
}

.terms-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.terms-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

.terms-checkbox-label span {
    user-select: none;
}

.terms-modal-footer {
    padding: 20px;
    border-top: 1px solid #ddd;
    text-align: center;
}

.terms-agree-btn {
    padding: 12px 40px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background-color: #2196F3;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.terms-agree-btn:hover:not(:disabled) {
    background-color: #1976D2;
    transform: scale(1.05);
}

.terms-agree-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.terms-agree-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* フッター */
.app-footer {
    background-color: #2a2a2a;
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    border-top: 2px solid #444;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.app-footer .company-name {
    font-size: 13px;
    font-weight: normal;
    text-decoration: none;
    color: white;
}

.app-footer .company-name:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.app-footer .survey-link {
    color: white;
    text-decoration: none;
    font-size: 13px;
    transition: opacity 0.3s ease;
}

.app-footer .survey-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.app-footer .footer-link {
    color: white;
    text-decoration: none;
    font-size: 13px;
    transition: opacity 0.3s ease;
}

.app-footer .footer-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* 写真表示エリアの全画面ボタンを写真画像内に配置 */
#current-photo-display {
    position: relative;
    width: 100%;
    height: 100%;
}

#photo-display-section .fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
}
