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

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

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 2.5em;
}

.subtitle {
    text-align: center;
    margin-bottom: 40px;
    color: #666;
    font-size: 1.2em;
}

/* セクション共通スタイル */
.input-section,
.loading-section,
.page-info-section,
.headings-section,
.error-section,
.usage-section,
.ad-section {
    background: white;
    margin-bottom: 30px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 20px;
}

.icon {
    width: 24px;
    height: 24px;
    color: #3b82f6;
}

/* URL入力セクション */
.url-input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.url-input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.url-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.extract-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.extract-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.extract-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    width: 18px;
    height: 18px;
}

.url-examples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.examples-title {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
}

.example-urls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.example-url {
    padding: 4px 8px;
    background: #f3f4f6;
    color: #374151;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-url:hover {
    background: #e5e7eb;
    color: #1f2937;
}

/* 読み込みセクション */
.loading-section {
    text-align: center;
    padding: 50px 30px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #6b7280;
    font-size: 1.1rem;
}

/* ページ情報セクション */
.page-info-grid {
    display: grid;
    gap: 15px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.info-label {
    font-weight: 600;
    color: #475569;
    min-width: 80px;
    font-size: 0.9rem;
}

.info-value {
    color: #1f2937;
    word-break: break-all;
    flex: 1;
}

/* 見出しセクション */
.headings-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.level-filters {
    display: flex;
    gap: 20px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.filter-checkbox input {
    display: none;
}

.checkmark {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.checkmark.h2 {
    background: #dbeafe;
    color: #1e40af;
}

.checkmark.h3 {
    background: #dcfce7;
    color: #166534;
}

.checkmark.h4 {
    background: #fef3c7;
    color: #92400e;
}

.filter-checkbox input:checked + .checkmark {
    border-color: currentColor;
    transform: scale(1.05);
}

.export-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

/* 見出し結果 */
.headings-result {
    background: #fafbfc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.heading-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

.heading-item:last-child {
    border-bottom: none;
}

.heading-level {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    min-width: 30px;
}

.heading-level.h2 {
    background: #dbeafe;
    color: #1e40af;
}

.heading-level.h3 {
    background: #dcfce7;
    color: #166534;
    margin-left: 20px;
}

.heading-level.h4 {
    background: #fef3c7;
    color: #92400e;
    margin-left: 40px;
}

.heading-text {
    flex: 1;
    color: #374151;
    line-height: 1.5;
}

.no-headings {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 40px 20px;
}

/* エラーセクション */
.error-message {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
}

.error-icon {
    width: 24px;
    height: 24px;
    color: #dc2626;
    flex-shrink: 0;
    margin-top: 2px;
}

.error-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 4px;
}

.error-text {
    color: #991b1b;
}

/* トーストメッセージ */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .input-section,
    .loading-section,
    .page-info-section,
    .headings-section,
    .error-section,
    .usage-section,
    .ad-section {
        padding: 20px;
        margin-bottom: 20px;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .url-input-container {
        flex-direction: column;
    }

    .headings-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .level-filters {
        justify-content: center;
    }

    .export-controls {
        justify-content: center;
    }

    .heading-level.h3 {
        margin-left: 15px;
    }

    .heading-level.h4 {
        margin-left: 30px;
    }

    .toast {
        left: 15px;
        right: 15px;
        transform: translateY(-100%);
        max-width: none;
    }

    .toast.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .url-examples {
        flex-direction: column;
        align-items: flex-start;
    }

    .level-filters {
        flex-wrap: wrap;
        gap: 10px;
    }

    .export-controls {
        justify-content: center;
    }
}