* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

header p {
    color: #666;
    font-size: 1.1rem;
}

.header-links {
    margin-top: 15px;
}

.guide-link {
    display: inline-block;
    padding: 8px 16px;
    background: #48bb78;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.guide-link:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

/* タブナビゲーション */
.tab-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e2e8f0;
}

.tab-button {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 500;
    color: #718096;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-button:hover {
    color: #4299e1;
}

.tab-button.active {
    color: #4299e1;
    border-bottom-color: #4299e1;
}

/* タブコンテンツ */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* セクションヘッダー */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.5rem;
    color: #2c3e50;
}

/* ボタン */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #4299e1;
    color: white;
}

.btn-primary:hover {
    background-color: #3182ce;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.btn-secondary {
    background-color: #48bb78;
    color: white;
}

.btn-secondary:hover {
    background-color: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.btn-outline {
    background-color: transparent;
    color: #718096;
    border: 2px solid #cbd5e0;
}

.btn-outline:hover {
    background-color: #f7fafc;
    color: #4a5568;
    border-color: #a0aec0;
}

.btn-icon {
    padding: 6px 12px;
    font-size: 0.85rem;
    background: #e2e8f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #cbd5e0;
}

/* 座席グリッド */
.seats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.seat-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.seat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.seat-image {
    width: 100%;
    height: 150px;
    background: #f7fafc;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.seat-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.seat-image .no-image {
    color: #a0aec0;
    font-size: 0.9rem;
}

.seat-info h4 {
    font-size: 1.1rem;
    margin-bottom: 4px;
    color: #2d3748;
}

.seat-info p {
    font-size: 0.9rem;
    color: #718096;
}

.seat-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* 人物グリッド */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.person-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    text-align: center;
}

.person-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.person-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 12px;
    border-radius: 50%;
    overflow: hidden;
    background: #f7fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.person-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.person-icon .no-icon {
    color: #a0aec0;
    font-size: 0.8rem;
}

.person-info h4 {
    font-size: 1rem;
    margin-bottom: 4px;
    color: #2d3748;
}

.person-pose {
    font-size: 0.85rem;
    color: #718096;
}

.person-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: auto;
}

.modal-content {
    background: white;
    margin: 50px auto;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 1.3rem;
    color: #2d3748;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #718096;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #2d3748;
}

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

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e2e8f0;
}

/* フォーム要素 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.form-group input[type="file"] {
    width: 100%;
    padding: 8px 0;
}

/* 画像プレビュー */
.image-preview,
.icon-preview {
    margin-top: 10px;
    width: 100%;
    max-width: 300px;
    height: 200px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-preview {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 10px auto 0;
}

.image-preview img,
.icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* グリッドサイズコントロール */
.grid-size-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.grid-size-controls label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
}

.grid-size-controls input {
    width: 60px;
}

/* 配置グリッド */
.placement-grid {
    display: grid;
    gap: 5px;
    margin: 10px 0;
    max-width: 600px;
}

.placement-cell {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.placement-cell:hover {
    background: #e6f2ff;
    border-color: #4299e1;
}

.placement-cell.selected {
    background: #4299e1;
    border-color: #3182ce;
}

.help-text {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 5px;
}

/* 配置場所ごとの画像設定 */
.placement-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.placement-image-item {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
}

.placement-image-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9rem;
}

.placement-image-input {
    width: 100%;
    margin-bottom: 8px;
}

.placement-image-preview {
    width: 100%;
    height: 100px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.placement-image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.delete-placement-image {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background-color: #fc8181;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.delete-placement-image:hover {
    background-color: #f56565;
    transform: scale(1.1);
    opacity: 1;
}

/* 座席プレビューキャンバス */
#seatPreviewCanvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
    background-image: 
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* 配置ワークスペース */
.arrange-workspace {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    gap: 20px;
    height: 600px;
}

.arrange-sidebar {
    background: white;
    border-radius: 12px;
    padding: 15px;
    overflow-y: auto;
}

.arrange-sidebar h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #2d3748;
}

.arrange-main {
    background: white;
    border-radius: 12px;
    padding: 20px;
}

.canvas-container {
    background: #f7fafc;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    overflow: auto;
}

#arrangeCanvas {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

.canvas-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* 配置アイテム */
.arrange-seat-item,
.arrange-person-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 8px;
    background: #f7fafc;
    border-radius: 6px;
    cursor: move;
    transition: all 0.2s ease;
}

.arrange-seat-item:hover,
.arrange-person-item:hover {
    background: #e6f2ff;
}

.seat-thumb,
.person-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.person-thumb {
    border-radius: 50%;
}

.seat-thumb img,
.person-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.seat-thumb .no-image,
.person-thumb .no-icon {
    font-size: 0.7rem;
    color: #a0aec0;
}

.arrange-seat-item span,
.arrange-person-item span {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* レイアウトコントロール */
.layout-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.layout-controls label {
    font-weight: 500;
    color: #4a5568;
}

.layout-controls select,
.layout-controls input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.95rem;
}

.layout-controls input[type="number"] {
    width: 70px;
}

.layout-controls span {
    color: #718096;
    font-size: 0.9rem;
}

/* レスポンシブデザイン */
@media (max-width: 1024px) {
    .arrange-workspace {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .arrange-sidebar {
        height: 200px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .tab-button {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .seats-grid {
        grid-template-columns: 1fr;
    }
    
    .people-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .modal-content {
        margin: 20px;
    }
    
    .canvas-controls {
        flex-direction: column;
    }
    
    .canvas-controls .btn {
        width: 100%;
    }
}

/* スポンサーウィジェット */
.sponsor-widget {
    margin-top: 100px;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.sponsor-widget iframe {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: #f7fafc;
}

.sponsor-note {
    margin-top: 15px;
    font-size: 0.9rem;
    color: #718096;
}

@media (max-width: 768px) {
    .sponsor-widget {
        margin-top: 40px;
        padding: 20px;
    }
    
    .sponsor-widget iframe {
        height: 300px;
    }
}

/* 解像度コントロール */
.resolution-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
}

.resolution-controls label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.resolution-controls input {
    width: 80px;
}

/* 解像度プリセットボタン */
.resolution-presets {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 8px 16px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    background: #e6f2ff;
    border-color: #4299e1;
}

/* 背景画像プレビュー */
#backgroundImagePreview {
    max-height: 150px;
}

#backgroundColor {
    width: 100px;
    height: 40px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
}

/* クリアドロップダウン */
.clear-dropdown {
    position: relative;
    display: inline-block;
}

.clear-dropdown-content {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    background-color: white;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    z-index: 100;
    margin-bottom: 4px;
    overflow: hidden;
}

.clear-dropdown-content.show {
    display: block;
}

.dropdown-item {
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    color: #4a5568;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f7fafc;
    color: #2d3748;
}

.dropdown-item:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}