/* ============================================
   X投稿用画像生成ツール - YZF-R1 Speed Design
   風・疾走感・爽快感をテーマにしたデザイン
   ============================================ */

/* CSS Variables - Deep Purplish Blue Metallic C (YZF-R1) Theme */
:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a2332;
    --bg-card: #222d3d;
    --bg-card-hover: #2a3848;
    --text-primary: #ffffff;
    --text-secondary: #b0bec5;
    --text-muted: #78909c;
    /* ディープパープリッシュブルーメタリックC */
    --accent-primary: #2c5282;
    --accent-secondary: #3d6a9f;
    --accent-light: #4a7ab8;
    --accent-gradient: linear-gradient(135deg, #2c5282 0%, #3d6a9f 50%, #4a7ab8 100%);
    --accent-metallic: linear-gradient(135deg, #2c5282 0%, #4a7ab8 25%, #2c5282 50%, #4a7ab8 75%, #2c5282 100%);
    /* 疾走感のある斜めグラデーション */
    --speed-gradient: linear-gradient(165deg, #1a2332 0%, #2c5282 50%, #4a7ab8 100%);
    --wind-stripe: repeating-linear-gradient(
        -15deg,
        transparent,
        transparent 2px,
        rgba(74, 122, 184, 0.03) 2px,
        rgba(74, 122, 184, 0.03) 4px
    );
    --success: #4ade80;
    --warning: #fbbf24;
    --error: #f87171;
    --border-color: #374151;
    --border-radius-sm: 4px;
    --border-radius-md: 6px;
    --border-radius-lg: 10px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(44, 82, 130, 0.5);
    --shadow-speed: 4px 0 20px rgba(74, 122, 184, 0.3);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Yu Gothic UI', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Animated Background - 風を切る疾走感 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        var(--wind-stripe),
        radial-gradient(ellipse at 20% 20%, rgba(44, 82, 130, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(61, 106, 159, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(74, 122, 184, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* 流れる風のライン */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: -100%;
    width: 300%;
    height: 100%;
    background: repeating-linear-gradient(
        -15deg,
        transparent,
        transparent 100px,
        rgba(74, 122, 184, 0.02) 100px,
        rgba(74, 122, 184, 0.02) 102px
    );
    animation: windFlow 20s linear infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes windFlow {
    0% { transform: translateX(0); }
    100% { transform: translateX(33.33%); }
}

/* Header - 疾走感のあるヘッダー */
header {
    background: linear-gradient(90deg, var(--bg-secondary) 0%, rgba(44, 82, 130, 0.2) 50%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
}

/* ヘッダーの疾走ライン */
header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
    animation: speedLine 3s ease-in-out infinite;
}

@keyframes speedLine {
    0%, 100% { opacity: 0.3; transform: scaleX(0.5); }
    50% { opacity: 1; transform: scaleX(1); }
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.05em;
}

header h1 a {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    transition: var(--transition-normal);
    position: relative;
}

header h1 a:hover {
    filter: brightness(1.2);
    letter-spacing: 0.1em;
}

/* Links - より明るく見やすい色 */
a {
    color: #6ba3d6;
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: #8bbef0;
    text-shadow: 0 0 8px rgba(139, 190, 240, 0.3);
}

a:visited {
    color: #6ba3d6;
}

/* Main Container */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 6rem;
}

/* Section Container */
.form-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    padding: 2rem;
    transition: var(--transition-normal);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

/* Thumbnail / Eyecatch */
.thumbnail {
    text-align: center;
    margin-bottom: 1rem;
}

.thumbnail img {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
}

.thumbnail img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.eyecatch {
    border-radius: var(--border-radius-lg);
}

/* Headings */
h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid transparent;
    background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
                var(--accent-gradient) border-box;
    border-image-slice: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h2::before {
    content: '';
    width: 4px;
    height: 1.2em;
    background: var(--accent-gradient);
    border-radius: 2px;
}

/* Form Styles */
form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
}

/* Labels */
label {
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0;
}

/* Radio Buttons - Custom */
input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-secondary);
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
}

input[type="radio"]:checked {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

input[type="radio"]:hover {
    border-color: var(--accent-primary);
}

/* Quality Mode Cards */
.quality-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.quality-option {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1rem 1.25rem;
    transition: var(--transition-normal);
    cursor: pointer;
}

.quality-option:hover {
    border-color: var(--accent-light);
    background: rgba(44, 82, 130, 0.25);
}

.quality-option:has(input:checked) {
    border-color: var(--accent-light);
    background: rgba(44, 82, 130, 0.35);
    box-shadow: 0 0 20px rgba(44, 82, 130, 0.5);
}

.quality-option label {
    width: 100%;
    padding: 0;
}

.quality-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.quality-label strong {
    font-size: 1rem;
}

.quality-label small {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Form Section */
.form-section {
    margin-bottom: 0.5rem;
}

.form-section-title {
    font-size: 1rem;
    font-weight: 500;
    margin: 0 0 0.75rem 0;
    color: var(--text-secondary);
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

/* File Input - Custom */
.file-input-wrapper {
    position: relative;
}

.file-input-label {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: block;
}

input[type="file"] {
    width: 100%;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-normal);
    font-size: 0.95rem;
}

input[type="file"]:hover {
    border-color: var(--accent-light);
    background: rgba(44, 82, 130, 0.15);
}

input[type="file"]:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.35);
}

input[type="file"]::file-selector-button {
    padding: 0.5rem 1rem;
    margin-right: 1rem;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--border-radius-sm);
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

input[type="file"]::file-selector-button:hover {
    filter: brightness(1.1);
}

/* Text Input */
input[type="text"],
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition-normal);
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.35);
}

input[type="text"]::placeholder {
    color: var(--text-muted);
}

input[type="number"] {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition-normal);
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.35);
}

/* Text Input Wrapper */
.text-input-wrapper {
    position: relative;
}

.text-input-wrapper label {
    display: block;
    margin-bottom: 0.5rem;
}

/* Button - 疾走感のあるボタン */
button {
    background: var(--accent-gradient);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.05em;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transform: skewX(-20deg);
    transition: none;
}

button:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-speed);
    letter-spacing: 0.1em;
}

button:hover::before {
    left: 150%;
    transition: 0.5s ease;
}

button:active {
    transform: translateX(2px);
}

button:disabled,
#exec:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button:disabled::before {
    display: none;
}

/* Error Messages */
.errMsg {
    color: var(--error);
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--error);
    margin-top: 0.5rem;
}

.errMsg::before {
    content: '⚠';
}

/* Success Message */
.success-message {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.success-message strong {
    color: var(--success);
    font-size: 1.1rem;
}

/* Output Images */
.outputimagelist {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
}

.outputimagelist a {
    display: block;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    transition: var(--transition-normal);
    position: relative;
}

.outputimagelist a::after {
    content: 'クリックでDL';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    font-size: 0.75rem;
    text-align: center;
    opacity: 0;
    transition: var(--transition-fast);
}

.outputimagelist a:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.outputimagelist a:hover::after {
    opacity: 1;
}

.outputimage,
.outputimagev2 {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--border-radius-md);
}

/* Instagram 3x3 Grid */
.instagram-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.5rem;
    max-width: 450px;
    margin: 0 auto;
}

.instagram-grid a {
    aspect-ratio: 1;
}

.instagram-grid .outputimage {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Frame Output - Single centered image */
.frame-output {
    display: flex !important;
    justify-content: center;
    max-width: 400px;
    margin: 0 auto;
}

.frame-output a {
    max-width: 100%;
}

/* Mode Selection Menu */
.mode-menu {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.mode-menu.single-column {
    grid-template-columns: 1fr;
    max-width: 400px;
}

/* カード全体をリンク化 */
.modeselect {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 0.75rem;
    padding-bottom: 1rem;
    transition: var(--transition-normal);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

/* カード内部レイアウト - 縦並び */
.modeselect-inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* 上部: サムネイル */
.modeselect-thumb {
    width: 100%;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.modeselect-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: var(--transition-normal);
}

/* 縦画像用サムネイル */
.modeselect-thumb.portrait {
    aspect-ratio: auto;
    display: flex;
    justify-content: center;
    background: var(--bg-secondary);
    height: 180px;
}

.modeselect-thumb.portrait img {
    width: auto;
    height: 100%;
    object-fit: contain;
}

/* 正方形画像用サムネイル */
.modeselect-thumb.square {
    aspect-ratio: 1 / 1;
    max-width: 200px;
    margin: 0 auto;
}

.modeselect-thumb.square img {
    object-fit: contain;
}

/* 下部: コンテンツ */
.modeselect-content {
    text-align: left;
}

.modeselect-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.modeselect-title svg {
    width: 18px;
    height: 18px;
    color: var(--accent-light);
    flex-shrink: 0;
}

.modeselect-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.modeselect-materials {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.material-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    background: rgba(74, 122, 184, 0.15);
    border-radius: var(--border-radius-sm);
    color: var(--accent-light);
}

.material-tag svg {
    width: 10px;
    height: 10px;
}

/* 疾走エフェクト用の斜めライン */
.modeselect::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(74, 122, 184, 0.1) 45%,
        rgba(74, 122, 184, 0.1) 55%,
        transparent 60%
    );
    transition: 0.6s ease;
    pointer-events: none;
}

/* 矢印アイコン */
.modeselect::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    bottom: 1rem;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234a7ab8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5l7 7-7 7'/%3E%3C/svg%3E");
    background-size: contain;
    opacity: 0.5;
    transition: var(--transition-normal);
}

.modeselect:hover {
    border-color: var(--accent-primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-speed);
    background: var(--bg-card-hover);
}

.modeselect:hover::before {
    left: 100%;
}

.modeselect:hover::after {
    opacity: 1;
    right: 0.5rem;
}

.modeselect:hover .modeselect-thumb img {
    transform: scale(1.05);
}

/* セクション見出し */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0 0.75rem;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    border: none;
}

.section-title svg {
    width: 20px;
    height: 20px;
    color: var(--accent-light);
}

.section-title .badge {
    margin-left: 0.25rem;
}

/* 旧スタイル互換（非推奨） */
.modeselect > strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.modeselect > p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

.modeimg {
    width: 100%;
    max-width: 280px;
    height: auto;
    margin-top: 0.75rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-normal);
}

.modeselect:hover .modeimg {
    transform: scale(1.02);
}

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}

/* Content Section */
.content {
    margin-top: 2rem;
    margin-bottom: 5rem;
}

.content h2 {
    margin-top: 2rem;
}

.content p {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Info Box */
.info-box {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    border-left: 3px solid var(--accent-primary);
}

.info-box h2 {
    margin: 0 0 0.5rem 0;
    padding: 0;
    border: none;
    font-size: 0.9rem;
    color: var(--accent-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-box h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: var(--accent-light);
    border-radius: 50%;
}

.info-box p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.7;
}

/* Color Classes */
.red {
    color: var(--error);
}

.green {
    color: var(--success);
}

.orange {
    color: var(--warning);
}

.blue {
    color: var(--accent-primary);
}

.yellow {
    color: #fbbf24;
}

.mini {
    font-size: 0.85rem;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-new {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.badge-popular {
    background: linear-gradient(135deg, var(--error), #f97316);
    color: white;
}

.badge-hot {
    background: linear-gradient(135deg, #ff4500, #ff8c00);
    color: white;
    animation: pulse-hot 1.5s ease-in-out infinite;
}

@keyframes pulse-hot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* 縦4分割結果コンテナ（横並び） */
.vertical4-result-container {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: nowrap;
    margin-bottom: 2rem;
}

.vertical4-result-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
    text-align: center;
    flex: 0 0 auto;
    width: 45%;
    max-width: 400px;
}

@media (max-width: 700px) {
    .vertical4-result-container {
        flex-wrap: wrap;
    }
    .vertical4-result-item {
        width: 100%;
        max-width: 350px;
    }
}

.vertical4-result-item h3 {
    margin: 0 0 0.5rem 0;
    color: var(--accent-light);
    font-size: 1.1rem;
}

.vertical4-result-item .result-desc {
    margin: 0 0 1rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* 結合プレビュー（縦4分割テスト用） */
.combined-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 360px;
    margin: 0 auto 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-secondary);
    padding: 8px;
}

.combined-preview img {
    width: 100%;
    display: block;
    border-radius: 2px;
}

/* ダウンロードボタン群 */
.download-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.dl-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--accent-gradient);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.dl-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: white;
}

/* Footer - 疾走感のあるフッター */
footer {
    background: linear-gradient(90deg, var(--bg-secondary) 0%, rgba(44, 82, 130, 0.15) 50%, var(--bg-secondary) 100%);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-align: center;
    padding: 1.5rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

footer p {
    margin: 0;
    font-size: 0.9rem;
}

footer a {
    color: #7db8e8;
    font-weight: 500;
}

footer a:hover {
    color: #a8d4ff;
    text-shadow: 0 0 8px rgba(168, 212, 255, 0.4);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
    z-index: 10;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Image Preview */
.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.image-preview-item {
    aspect-ratio: 1;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    position: relative;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: var(--error);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-fast);
}

.image-preview-item:hover .remove-btn {
    opacity: 1;
}

/* Drag & Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 2rem;
    text-align: center;
    transition: var(--transition-normal);
    cursor: pointer;
}

.drop-zone.dragover {
    border-color: var(--accent-light);
    background: rgba(44, 82, 130, 0.2);
}

.drop-zone-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.drop-zone-text {
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    main {
        padding: 1rem 1rem 5rem;
    }

    form {
        padding: 1.5rem;
    }

    .quality-options {
        grid-template-columns: 1fr;
    }

    .mode-menu {
        grid-template-columns: 1fr;
    }

    .modeselect {
        padding: 1rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    header h1 {
        font-size: 1.2rem;
    }

    .outputimagelist {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .outputimagelist {
        grid-template-columns: 1fr;
    }

    button {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* Animations - 疾走感のあるアニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* 連続する要素の段階的フェードイン */
.fade-in:nth-child(1) { animation-delay: 0s; }
.fade-in:nth-child(2) { animation-delay: 0.1s; }
.fade-in:nth-child(3) { animation-delay: 0.2s; }
.fade-in:nth-child(4) { animation-delay: 0.3s; }

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: var(--accent-primary);
    color: white;
}

/* Site Description */
.site-description {
    text-align: center;
    padding: 1.5rem 1rem;
    margin-bottom: 1rem;
}

.site-description p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.8;
    margin: 0;
}

/* Section anchor offset for fixed header */
.section-title[id] {
    scroll-margin-top: 80px;
}

/* Section Navigation */
.section-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(51, 65, 85, 0.4) 100%);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
}

.nav-link,
.nav-link:link,
.nav-link:visited {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--nav-accent, #60a5fa);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.nav-link svg {
    width: 18px;
    height: 18px;
    color: var(--nav-accent, #60a5fa);
    flex-shrink: 0;
}

.nav-link:hover,
.nav-link:active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-link:hover::before {
    opacity: 1;
}

/* カテゴリ別カラー */
.nav-link[href*="section-x"] {
    --nav-accent: #60a5fa;
}
.nav-link[href*="section-neta"] {
    --nav-accent: #f472b6;
}
.nav-link[href*="section-simple"] {
    --nav-accent: #a78bfa;
}
.nav-link[href*="section-instagram"] {
    --nav-accent: #fb923c;
}

@media (max-width: 480px) {
    .section-nav {
        gap: 0.5rem;
        padding: 1rem;
    }

    .nav-link {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

    .nav-link svg {
        width: 16px;
        height: 16px;
    }
}

/* Section Header Row with Back to Top */
.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 2rem 0 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(51, 65, 85, 0.9) 100%);
    border-radius: var(--border-radius-md);
    border-left: 4px solid var(--accent-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.section-header-row::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(74, 122, 184, 0.1));
    pointer-events: none;
}

.section-header-row .section-title {
    margin: 0;
    flex: 1;
    font-size: 1rem;
    color: #fff;
}

.section-header-row .section-title svg {
    width: 22px;
    height: 22px;
    color: var(--accent-light);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* カテゴリ別カラー */
.section-header-row:has(#section-x) {
    border-left-color: #60a5fa;
}
.section-header-row:has(#section-x) .section-title svg {
    color: #60a5fa;
}

.section-header-row:has(#section-neta) {
    border-left-color: #f472b6;
}
.section-header-row:has(#section-neta) .section-title svg {
    color: #f472b6;
}

.section-header-row:has(#section-simple) {
    border-left-color: #a78bfa;
}
.section-header-row:has(#section-simple) .section-title svg {
    color: #a78bfa;
}

.section-header-row:has(#section-instagram) {
    border-left-color: #fb923c;
}
.section-header-row:has(#section-instagram) .section-title svg {
    color: #fb923c;
}

/* Back to Top Link */
.back-to-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.4rem 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    transition: all var(--transition-fast);
    border: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.back-to-top::before {
    content: '↑';
    font-size: 0.75rem;
}

.back-to-top:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Blog Promo Section */
.blog-promo {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(44, 82, 130, 0.4) 100%);
    border: 1px solid var(--accent-primary);
    border-radius: var(--border-radius-lg);
    padding: 0;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: row;
}

.blog-promo::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(74, 122, 184, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.blog-promo-image {
    flex: 0 0 45%;
    max-width: 45%;
    position: relative;
    overflow: hidden;
}

.blog-promo-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-normal);
}

.blog-promo:hover .blog-promo-image img {
    transform: scale(1.03);
}

.blog-promo-image::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 60px;
    background: linear-gradient(90deg, transparent 0%, var(--bg-card) 100%);
    pointer-events: none;
}

.blog-promo-content {
    flex: 1;
    padding: 1.5rem 1.5rem 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.blog-promo h2 {
    margin: 0 0 0.5rem 0;
    padding: 0;
    border: none;
    font-size: 1.2rem;
    color: var(--accent-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-promo h2::before {
    content: '';
    display: none;
}

.blog-promo-badge {
    display: inline-block;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.blog-promo-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.7;
    margin: 0 0 1rem 0;
}

.blog-promo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.blog-promo-tag {
    background: rgba(44, 82, 130, 0.3);
    color: var(--accent-light);
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    border: 1px solid rgba(74, 122, 184, 0.3);
}

.blog-promo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    background: var(--accent-gradient);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    align-self: flex-start;
    box-shadow: 0 2px 10px rgba(44, 82, 130, 0.3);
}

.blog-promo-link:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-speed), 0 4px 20px rgba(44, 82, 130, 0.4);
    color: white;
}

.blog-promo-link svg {
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.blog-promo-link:hover svg {
    transform: translateX(2px);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .blog-promo {
        flex-direction: column;
    }

    .blog-promo-image {
        flex: none;
        max-width: 100%;
        height: 180px;
    }

    .blog-promo-image::after {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 40px;
        background: linear-gradient(180deg, transparent 0%, var(--bg-card) 100%);
    }

    .blog-promo-content {
        padding: 1rem 1.25rem 1.25rem;
    }
}

/* SNS投稿風 - エンゲージメント入力グリッド */
.engagement-inputs {
    margin-top: 1rem;
}

.engagement-inputs .file-input-label {
    display: block;
    margin-bottom: 0.5rem;
}

.engagement-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.engagement-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.engagement-item label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.engagement-item input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

/* エンゲージメントヘッダー */
.engagement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.engagement-header .file-input-label {
    margin-bottom: 0;
}

/* お任せチェックボックス */
.random-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.random-check:hover {
    border-color: var(--accent-light);
    color: var(--text-primary);
}

.random-check input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
}

.random-check:has(input:checked) {
    background: rgba(44, 82, 130, 0.3);
    border-color: var(--accent-light);
    color: var(--text-primary);
}

/* 数値入力ラッパー */
.number-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
}

.number-input-wrapper input {
    width: 80px;
    padding: 0.5rem 0.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: none;
    border-right: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    text-align: center;
}

.number-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.number-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-btn.minus {
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
}

.number-btn.plus {
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.number-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.number-btn:active {
    transform: scale(0.95);
}

/* お任せ時のグリッド無効化 */
.engagement-grid.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.engagement-grid.disabled .number-btn {
    cursor: not-allowed;
}

/* SNS投稿風 - テキストエリア */
#postText {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    transition: all var(--transition-fast);
}

#postText:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(44, 82, 130, 0.2);
}

/* SNSタイプ選択のスタイル調整 */
.sns-type-selector {
    margin-bottom: 1rem;
}

.sns-type-selector .quality-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sns-type-selector .quality-option span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sns-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .engagement-grid {
        grid-template-columns: 1fr;
    }
}

/* 入力ヒント */
.input-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    margin-bottom: 0;
}

/* 必須マーク */
.mini.required {
    color: #e74c3c;
}

/* バズ演出セクション */
.buzz-effect-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.buzz-effect-section .quality-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* エンゲージメントグリッド3列対応 */
@media (min-width: 600px) {
    .engagement-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
