@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;600;700;800;900&family=Noto+Serif+JP:wght@300;400;500;600;700;900&family=M+PLUS+Rounded+1c:wght@300;400;500;700;800;900&family=Kosugi+Maru&family=Sawarabi+Gothic&family=Zen+Kaku+Gothic+New:wght@300;400;500;700;900&display=swap');

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

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --success: #10b981;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: rgba(148, 163, 184, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 16px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    animation: bgPulse 10s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(40px);
    border-radius: 20px;
    box-shadow: 
        0 25px 70px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    position: relative;
    z-index: 1;
    animation: slideInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

header {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #06b6d4 100%);
    color: white;
    padding: 48px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
    animation: headerGlow 12s ease-in-out infinite;
}

@keyframes headerGlow {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(10%, 10%) rotate(120deg); }
    66% { transform: translate(-10%, -10%) rotate(240deg); }
}

header h1 {
    font-size: 2.75rem;
    margin-bottom: 10px;
    font-weight: 800;
    letter-spacing: -1px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 30px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.125rem;
    opacity: 0.95;
    font-weight: 500;
    position: relative;
    z-index: 1;
    letter-spacing: -0.2px;
}

.manual-link {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.manual-link:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.main-content {
    display: grid;
    grid-template-columns: 500px 1fr;
    gap: 0;
    min-height: calc(100vh - 200px);
}

.sidebar {
    background: linear-gradient(180deg, #fafbfc 0%, #f8f9fa 100%);
    backdrop-filter: blur(10px);
    padding: 28px 32px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    position: relative;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, 
        transparent 0%, 
        rgba(148, 163, 184, 0.3) 50%, 
        transparent 100%);
}

.preview-area {
    padding: 32px;
    background: #ffffff;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.section {
    margin-bottom: 20px;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section h2 {
    font-size: 1.125rem;
    margin-bottom: 0;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary);
    padding: 14px 18px;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    letter-spacing: -0.3px;
    position: relative;
    overflow: hidden;
}

.section h2::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.08) 0%, transparent 100%);
    transition: width 0.35s ease;
    z-index: 0;
}

.section h2:hover::before {
    width: 100%;
}

.section h2:hover {
    transform: translateX(2px);
    box-shadow: var(--shadow-md);
    border-left-width: 4px;
    background: #ffffff;
}

.section h2::after {
    content: '▼';
    font-size: 0.7rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--primary);
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.section h2.collapsed::after {
    transform: rotate(-90deg);
}

.section-content {
    padding: 20px 18px;
    transition: all 0.25s ease;
    overflow: hidden;
    background: #ffffff;
    border-radius: 0 0 10px 10px;
    margin-top: -4px;
}

.section-content.collapsed {
    display: none;
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    letter-spacing: -0.2px;
}

label::before {
    content: '● ';
    color: var(--primary);
    font-weight: 700;
    margin-right: 6px;
    font-size: 0.6rem;
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    font-family: inherit;
    color: var(--text-primary);
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.1),
        var(--shadow-sm);
}

select optgroup {
    font-weight: 700;
    color: var(--text-secondary);
    background: #f8fafc;
    padding: 8px 0;
}

select option {
    padding: 8px 12px;
    font-weight: 500;
    color: var(--text-primary);
}

input[type="number"] {
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    font-family: inherit;
    color: var(--text-primary);
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.1),
        var(--shadow-sm);
}

input[type="color"] {
    height: 42px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s;
}

input[type="color"]:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: scale(1.02);
}

textarea {
    min-height: 120px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    resize: vertical;
    line-height: 1.65;
}

.btn {
    padding: 11px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 10px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
    letter-spacing: -0.2px;
    font-family: inherit;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn:hover::before {
    width: 280px;
    height: 280px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: #64748b;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    background: #475569;
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    transform: translateY(-2px);
    background: #059669;
    box-shadow: var(--shadow-md);
}

.btn-info {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-info:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    box-shadow: var(--shadow-md);
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.btn-group .btn {
    width: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
    padding: 13px 24px;
}

.preview-container {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    min-height: 600px;
    max-height: calc(100vh - 250px);
    overflow: auto;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.preview-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--primary) 50%, 
        transparent 100%);
    opacity: 0.3;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.preview-header > div:first-child {
    flex: 0 0 auto;
}

.preview-header .preview-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
}

.preview-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.7px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.preview-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #6c757d;
}

.preview-status-label {
    color: #6c757d;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #1f2937;
}

.status-auto {
    background: #d1fae5;
    color: #065f46;
}

.status-manual {
    background: #fff7ed;
    color: #9a3412;
}

.preview-actions {
    display: flex;
    flex-direction: row;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.preview-actions .btn {
    flex: 0 0 auto;
    min-width: auto;
    width: 44px;
    height: 44px;
    margin: 0;
    font-size: 1.3rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.preview-actions .btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: var(--shadow-md);
}

.preview-actions .btn:active {
    transform: translateY(-1px) scale(1.05);
    box-shadow: var(--shadow-sm);
}

.preview-actions .btn:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    animation: tooltipFadeIn 0.15s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        bottom: -28px;
    }
    to {
        opacity: 1;
        bottom: -32px;
    }
}

.preview-actions .btn:hover::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-bottom-color: rgba(15, 23, 42, 0.95);
    z-index: 1001;
    pointer-events: none;
}

.scale-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.scale-controls button {
    padding: 7px 14px;
    font-size: 0.875rem;
    min-width: 50px;
    border-radius: 8px;
    font-weight: 600;
}

.scale-controls #scale-display {
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    min-width: 50px;
    text-align: center;
    font-size: 0.95rem;
}

#preview-frame {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: white;
    min-height: 800px;
    width: 100%;
    display: block;
    box-shadow: var(--shadow-sm);
}

/* モーダルウィンドウスタイル */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    z-index: 10000;
    backdrop-filter: blur(8px);
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}

.modal-content {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    max-width: 90%;
    max-height: 90%;
    width: 1200px;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 20px 28px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
    pointer-events: none;
}

.modal-header h2 {
    font-size: 1.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: -0.4px;
    position: relative;
    z-index: 1;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    max-height: calc(90vh - 200px);
}

.code-display {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.code-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--primary) 50%, 
        transparent 100%);
    opacity: 0.5;
}

.code-display textarea {
    width: 100%;
    min-height: 400px;
    max-height: 600px;
    background: rgba(15, 23, 42, 0.9);
    color: #e2e8f0;
    border: 1.5px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.65;
    resize: vertical;
    overflow-y: auto;
}

.code-display textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.code-display textarea:not([readonly]) {
    background: #ffffff;
    color: #1e293b;
    border: 2px solid #ffc107;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.4), inset 0 2px 4px rgba(255, 193, 7, 0.1);
    font-weight: 500;
}

.code-display textarea:not([readonly]):focus {
    background: #ffffff;
    border-color: #ff9800;
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.5), inset 0 2px 4px rgba(255, 152, 0, 0.1);
}

#edit-mode-toggle:checked + span {
    color: #ff9800;
    font-weight: 700;
}

.code-display:has(textarea:not([readonly]))::after {
    content: '✏️ 編集中';
    position: absolute;
    top: 25px;
    right: 25px;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4);
    z-index: 10;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.code-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

@keyframes slideUp {
    from {
        transform: translateY(40px) scale(0.96);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* フッタースタイル */
.footer {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
    color: white;
    padding: 24px 32px;
    text-align: center;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
}

.footer a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
    padding-bottom: 2px;
}

.footer a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: white;
    transition: width 0.2s ease;
}

.footer a:hover {
    opacity: 0.85;
}

.footer a:hover::after {
    width: 100%;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.sample-templates {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.sample-btn {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    background: white;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}

.sample-btn:hover {
    border-color: var(--primary);
    background: #f0f9ff;
    transform: translateX(2px);
    box-shadow: var(--shadow-sm);
}

.variable-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 6px;
    font-style: italic;
}

.help-text {
    font-size: 0.85rem;
    color: #495057;
    margin-top: 5px;
    padding: 8px 12px;
    background: #e7f3ff;
    border-left: 3px solid #667eea;
    border-radius: 4px;
    line-height: 1.5;
}

.section-description {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 3px solid #667eea;
}

.quickstart-steps {
    margin: 0 0 12px 18px;
    color: #495057;
    line-height: 1.7;
}

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

.band-color-input {
    width: 30px;
    height: 20px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 5px;
    vertical-align: middle;
}

.alert {
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
    border: 2px solid #bee5eb;
    border-left: 4px solid #17a2b8;
    box-shadow: 0 2px 4px rgba(23, 162, 184, 0.1);
}

.debug-tools {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border: 2px solid #dee2e6;
}

.tab-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #dee2e6;
}

.tab-btn {
    flex: 1;
    padding: 14px 22px;
    border: none;
    background: transparent;
    color: #6c757d;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    letter-spacing: -0.1px;
    position: relative;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.tab-btn.active::before {
    opacity: 1;
}

.tab-btn:hover {
    background: linear-gradient(135deg, rgba(248, 249, 250, 0.8) 0%, rgba(233, 236, 239, 0.8) 100%);
    color: #667eea;
    transform: translateY(-2px);
}

.tab-content {
    display: none;
}

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

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: grid;
    grid-template-columns: 24px 20px minmax(120px, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    gap: 10px 12px;
    cursor: pointer;
    padding: 12px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
}

.checkbox-label .order-indicator {
    grid-row: 1 / 3;
}

.checkbox-label > input[type="checkbox"]:first-of-type {
    grid-row: 1;
}

.checkbox-label .field-label-text {
    grid-row: 1;
}

.checkbox-label > div:first-child:not(.order-indicator):not(.field-label-text) {
    grid-column: 2 / 4;
    grid-row: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.checkbox-label > div[style*="width: 100%"] {
    grid-column: 1 / 4;
    grid-row: 3;
    margin-top: 4px;
    padding-left: 0;
}

.checkbox-label:hover {
    background: rgba(59, 130, 246, 0.05);
    transform: translateX(2px);
    box-shadow: var(--shadow-sm);
    border-color: rgba(59, 130, 246, 0.3);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.checkbox-label .field-label-text {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
}

.checkbox-label > div:first-child {
    display: contents;
}

.checkbox-label > div[style*="margin-left"] {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 5px;
    border: 1px solid rgba(255, 193, 7, 0.2);
    white-space: nowrap;
}

.checkbox-label > div[style*="margin-left"] input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.checkbox-label > div[style*="margin-left"] span {
    font-size: 11px;
    color: #f39c12;
    font-weight: 600;
}

.field-size-control {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(102, 126, 234, 0.08);
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    white-space: nowrap;
    min-width: fit-content;
}

.field-size-control label {
    font-size: 11px;
    color: #667eea;
    margin: 0;
    font-weight: 600;
    flex-shrink: 0;
}

.field-size-control span {
    font-size: 11px;
    color: #6c757d;
    flex-shrink: 0;
}

.field-size-input {
    width: 60px;
    padding: 6px 8px;
    font-size: 13px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 5px;
    text-align: center;
    background: white;
    color: #2c3e50;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 60px;
}

.field-size-input:focus {
    outline: none;
    border-color: #667eea;
    background: #f8f9ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    transform: scale(1.05);
}

.order-controls {
    display: flex;
    gap: 4px;
}

.order-btn {
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 600;
    border: 1.5px solid var(--border-color);
    background: #ffffff;
    color: var(--primary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    line-height: 1;
}

.order-btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.order-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.order-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f1f5f9;
    color: #94a3b8;
    border-color: var(--border-color);
}

.order-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    text-align: center;
    font-size: 10px;
    color: white;
    font-weight: 700;
    background: var(--primary);
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
}

input[type="color"] {
    width: 100%;
    height: 38px;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

input[type="file"] {
    padding: 12px 14px;
    border: 2px dashed rgba(148, 163, 184, 0.4);
    border-radius: 8px;
    cursor: pointer;
    background: #f8fafc;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    font-size: 0.875rem;
}

input[type="file"]:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.card-tab-buttons {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.card-tab-btn {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    background: white;
    color: #6c757d;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

.card-tab-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.card-tab-btn:hover {
    border-color: #667eea;
}

.card-config {
    display: none;
    padding: 15px;
    border: 2px solid #e1e4e8;
    border-radius: 5px;
    background: #f8f9fa;
}

.card-config.active {
    display: block;
}

.card-config h4 {
    margin-top: 0;
    color: #667eea;
    font-size: 1rem;
}

.copy-config-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    margin-bottom: 14px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.copy-config-btn:hover {
    transform: translateY(-2px);
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.copy-config-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.color-rule-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.color-rule-condition {
    padding: 6px 10px;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
}

.color-rule-color {
    width: 56px;
    height: 32px;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

#color-rules-container {
    margin-bottom: 10px;
}

.bg-rule-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.bg-rule-condition {
    padding: 6px 10px;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
}

.bg-rule-url {
    padding: 6px 10px;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
}

#bg-rules-container {
    margin-bottom: 10px;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: none;
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .preview-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .preview-actions .btn {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }
    
    .preview-actions > div {
        display: none;
    }
    
    .scale-controls {
        width: 100%;
        justify-content: center;
    }
    
    .btn-group .btn {
        font-size: 0.95rem;
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    .preview-actions .btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .preview-actions {
        gap: 8px;
    }
    
    .preview-actions > div {
        margin: 0 3px;
    }
}
