/* ===================================
   リセット & ベーススタイル
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* カラーパレット */
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;

    /* グラデーション */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

    /* ニュートラルカラー */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* ボーダー */
    --border-color: #334155;
    --border-light: #475569;

    /* シャドウ */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

    /* スペーシング */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* ボーダー半径 */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* トランジション */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Noto Sans JP', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 背景アニメーション */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(236, 72, 153, 0.05) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundPulse 15s ease-in-out infinite;
}

@keyframes backgroundPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* ===================================
   コンテナ & レイアウト
   =================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* ===================================
   ヘッダー
   =================================== */
.header {
    text-align: center;
    padding: var(--spacing-2xl) 0;
    margin-bottom: var(--spacing-xl);
    position: relative;
}

.header-content {
    position: relative;
    z-index: 1;
}

.title {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-md);
    display: inline-block;
    animation: titleFloat 3s ease-in-out infinite;
}

@keyframes titleFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.icon {
    display: inline-block;
    animation: iconRotate 4s linear infinite;
    margin-right: var(--spacing-sm);
}

@keyframes iconRotate {

    0%,
    90%,
    100% {
        transform: rotate(0deg);
    }

    95% {
        transform: rotate(15deg);
    }
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ===================================
   メインコンテンツ
   =================================== */
.main-content {
    margin-bottom: var(--spacing-2xl);
}

.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
}

@media (max-width: 1024px) {
    .two-column {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   カード
   =================================== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.card:hover::before {
    opacity: 1;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    border-color: var(--border-light);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-lg);
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    margin-bottom: 0;
    white-space: nowrap;
}

.card-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.5rem;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    margin-right: var(--spacing-md);
}

/* ===================================
   タイプセレクター (製品 vs 本)
   =================================== */
.type-selector {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    background: var(--bg-tertiary);
    padding: 6px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

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

.type-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.type-icon {
    font-size: 1.25rem;
}

/* ===================================
   フォーム要素
   =================================== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.required {
    color: var(--accent-color);
    margin-left: var(--spacing-xs);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-base);
    outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: var(--bg-secondary);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23cbd5e1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--spacing-md) center;
    padding-right: var(--spacing-2xl);
}

/* ===================================
   ボタン
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all var(--transition-base);
    text-decoration: none;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

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

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

.btn-icon {
    margin-right: var(--spacing-sm);
    font-size: 1.25rem;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-light);
}

/* ===================================
   アラート
   =================================== */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    animation: slideIn var(--transition-base);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.alert-icon {
    margin-right: var(--spacing-md);
    font-size: 1.25rem;
}

/* ===================================
   アクションボタン & モード切替
   =================================== */
.action-buttons {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    flex-wrap: wrap;
}

.mode-toggle {
    display: flex;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.btn-toggle {
    background: transparent;
    border: none;
    padding: 6px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-toggle:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* ===================================
   記事プレビュー & 編集エリア
   =================================== */
.article-preview-container {
    margin-bottom: var(--spacing-lg);
}

.article-preview {
    background: var(--bg-tertiary);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    max-height: 700px;
    overflow-y: auto;
    line-height: 1.8;
    font-size: 1.05rem;
    color: var(--text-primary);
}

/* Markdown スタイル (note.com風) */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.markdown-body h1 {
    font-size: 1.75rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.markdown-body h2 {
    font-size: 1.5rem;
    padding-left: 1rem;
    border-left: 4px solid var(--primary-color);
}

.markdown-body h3 {
    font-size: 1.25rem;
}

.markdown-body p {
    margin-bottom: 1.5rem;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.markdown-body li {
    margin-bottom: 0.5rem;
}

.markdown-body blockquote {
    border-left: 4px solid var(--border-light);
    color: var(--text-secondary);
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
}

.markdown-body strong {
    color: var(--primary-light);
    font-weight: 700;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border-light);
    padding: 0.75rem;
    text-align: left;
}

.markdown-body th {
    background: var(--bg-secondary);
}

.article-textarea {
    width: 100%;
    min-height: 600px;
    max-height: 700px;
    overflow-y: auto;
    padding: var(--spacing-xl);
    background: var(--bg-tertiary);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: 'Inter', 'Noto Sans JP', monospace;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    display: none;
    /* 初期状態は非表示 */
    outline: none;
}

.article-textarea:focus {
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* ===================================
   情報カード
   =================================== */
.info-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-top: var(--spacing-lg);
    max-width: 100%;
    overflow-x: hidden;
}

.info-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.info-list {
    color: var(--text-secondary);
    padding-left: var(--spacing-lg);
}

.info-list li {
    margin-bottom: var(--spacing-sm);
}

.note-info {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(236, 72, 153, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.note-info-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.note-info-list {
    color: var(--text-secondary);
    list-style: none;
    padding-left: 0;
}

.note-info-list li {
    margin-bottom: var(--spacing-sm);
    padding-left: var(--spacing-lg);
    position: relative;
}

.note-info-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

.note-info-list ul {
    margin-top: var(--spacing-sm);
    padding-left: var(--spacing-lg);
}

/* ===================================
   空の状態
   =================================== */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-lg);
    opacity: 0.5;
    animation: emptyIconFloat 3s ease-in-out infinite;
}

@keyframes emptyIconFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.empty-text {
    font-size: 1.125rem;
    line-height: 1.6;
}

/* ===================================
   ヘッダー画像プレビュー
   =================================== */
.header-image-preview {
    margin-bottom: var(--spacing-xl);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.header-img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1792 / 1024;
    object-fit: cover;
}

.image-actions {
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.image-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
}

/* ===================================
   トースト通知
   =================================== */
.toast {
    position: fixed;
    bottom: var(--spacing-xl);
    right: var(--spacing-xl);
    background: var(--gradient-success);
    color: white;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    transform: translateY(150%);
    transition: transform var(--transition-base);
    z-index: 1000;
}

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

.toast-icon {
    margin-right: var(--spacing-md);
    font-size: 1.25rem;
}

.toast-text {
    font-weight: 500;
}

/* ===================================
   ローディングオーバーレイ
   =================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--spacing-lg);
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 500;
}

/* ===================================
   フッター
   =================================== */
.footer {
    text-align: center;
    padding: var(--spacing-xl) 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

/* ===================================
   レスポンシブ
   =================================== */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card {
        padding: var(--spacing-lg);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }

    .toast {
        bottom: var(--spacing-md);
        right: var(--spacing-md);
        left: var(--spacing-md);
    }

    .two-column {
        display: block;
    }

    .sticky-sidebar {
        position: relative !important;
        top: auto !important;
        width: 100%;
        max-width: 100%;
        margin-bottom: var(--spacing-lg);
        overflow: hidden;
    }

    #rankingList {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        overflow-x: hidden;
    }

    .ranking-item {
        padding: 4px;
        max-width: 100%;
    }

    .ranking-img-wrapper {
        max-width: 100%;
        width: 100%;
        height: 70px;
    }

    .ranking-img {
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    .ranking-title {
        font-size: 0.5rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .output-card {
        margin-top: var(--spacing-lg);
        padding: var(--spacing-lg);
    }

    .article-preview-container {
        position: relative;
        z-index: 2;
        margin-top: var(--spacing-lg);
        clear: both;
    }

    .action-buttons {
        margin-bottom: var(--spacing-md);
    }

    .header a { /* Target all links within the header */
        /* white-space: nowrap;  Removed this as it's not needed and can cause issues. */
    }

    .header { /* Ensure the header can scroll horizontally if its content overflows */
        /* overflow-x: auto; Removed this as it can cause undesirable horizontal scrolling. */
    }
}

/* ===================================
   ユーティリティ
   =================================== */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: var(--spacing-sm);
}

.mt-2 {
    margin-top: var(--spacing-md);
}

.mt-3 {
    margin-top: var(--spacing-lg);
}

.mt-4 {
    margin-top: var(--spacing-xl);
}

.mb-1 {
    margin-bottom: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

.mb-3 {
    margin-bottom: var(--spacing-lg);
}

.mb-4 {
    margin-bottom: var(--spacing-xl);
}

/* ===================================
   ランキング・トレンド
   =================================== */
#rankingList {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.btn-tab {
    background: transparent;
    border: none;
    padding: 6px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-tab.active {
    background: var(--bg-secondary);
    color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.btn-tab:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.ranking-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.ranking-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.ranking-img-wrapper {
    width: 100%;
    height: 80px; /* 明示的に高さを指定 */
    min-height: 80px; /* 最小高さを確保 */
    overflow: hidden;
    border-radius: 4px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.ranking-img {
    max-width: 100%;
    max-height: 100%; /* ラッパーの高さに合わせる */
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.ranking-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.ranking-title {
    font-size: 0.625rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-primary);
    min-height: 2.6em;
    text-align: center;
}

.ranking-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: var(--primary-color);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}
/* ===================================
   SEOスコア分析パネル
   =================================== */
.seo-score-panel {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    position: relative;
    overflow: hidden;
}

.seo-score-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.seo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.seo-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.btn-small {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
}

.seo-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.spinner-small {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.seo-results {
    animation: fadeIn 0.5s ease-in-out;
}

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

.seo-overall {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--spacing-xl);
    align-items: center;
    padding: var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--border-color);
}

@media (max-width: 640px) {
    .seo-overall {
        grid-template-columns: 1fr;
        text-align: center;
    }

    /* #rankingList now remains 3 columns even on smaller screens */
    #rankingList {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .ranking-img-wrapper {
        height: 90px;
    }
}

@media (max-width: 480px) {
    /* #rankingList now remains 3 columns even on very small screens */
    #rankingList {
        grid-template-columns: repeat(3, 1fr);
    }

    .ranking-img-wrapper {
        height: 110px;
    }
}

.seo-grade-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.4);
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.4); }
    50% { box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.6); }
}

.grade-text {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.grade-label {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    margin-top: var(--spacing-xs);
}

.seo-score-bar { flex: 1; }

.score-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

.score-bar-bg {
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.score-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 12px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.score-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: var(--spacing-sm);
}

.seo-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.seo-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: all var(--transition-base);
}

.seo-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}

.seo-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.seo-item-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.seo-item-score {
    font-weight: 700;
    font-size: 1.125rem;
}

.seo-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.seo-status-excellent {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.seo-status-good {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.seo-status-warning {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.seo-status-error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.seo-status-info {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.seo-item-message {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-top: var(--spacing-sm);
}

.seo-item-details {
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ===================================
   ソースセレクター (Amazon vs Trend)
   =================================== */
.source-selector {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    background: var(--bg-tertiary);
    padding: 6px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}
.source-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}
.source-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}
.source-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.list-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

#trendsList {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px;
}
.trend-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 12px;
}
.trend-item:hover {
    transform: translateX(3px);
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}
.trend-badge {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}
.trend-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

@media (max-width: 480px) {
    .title {
        font-size: 1.5rem;
        gap: 0.25rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }
    
    .header {
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }
    
    .title .icon {
        font-size: 1.2rem;
    }
}

