/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #fafafa;
    --bg-secondary: #f5f5f5;
    --bg-card: #ffffff;
    --accent-primary: #c9a962;
    --accent-secondary: #1a1a1a;
    --accent-gradient: linear-gradient(135deg, #c9a962 0%, #e8d5a3 50%, #c9a962 100%);
    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-muted: #999999;
    --success: #2d8a4e;
    --warning: #c9a962;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.08);
    --border-color: #e8e8e8;
}

body {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
    background: var(--bg-primary);
    background-image: linear-gradient(rgba(250, 250, 250, 0.9), rgba(250, 250, 250, 0.8)), url('images/bg.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
    background-size: cover;
    color: var(--text-primary);
    min-height: 100vh;
    letter-spacing: 0.02em;
}

/* Navigation Bar */
.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-brand {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 0.08em;
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.nav-brand:hover {
    opacity: 0.8;
}

.nav-logo {
    height: 32px;
    width: auto;
    display: block;
}


/* Tool Navigation Dropdown */
.nav-tools {
    position: relative;
}

.nav-tools-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tools-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}


.nav-tools-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    min-width: 140px;
    z-index: 100;
    overflow: hidden;
}

.nav-tools-dropdown.open {
    display: block;
}

.nav-tool-link {
    display: block;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.nav-tool-link:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-tool-link.active {
    color: var(--accent-primary);
    font-weight: 600;
    background: var(--bg-secondary);
}

/* Hub Page */
.hub-container {
    max-width: 700px;
    text-align: center;
    padding-top: 60px;
}

.hub-header {
    margin-bottom: 40px;
}

.hub-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.hub-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

.hub-tools {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    width: 100%;
    margin-bottom: 32px;
}

.hub-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.hub-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(201,169,98,0.08) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.hub-card > * {
    position: relative;
    z-index: 1;
}

.hub-card:hover {
    box-shadow: 0 16px 48px rgba(201,169,98, 0.15);
    transform: translateY(-4px);
    border-color: rgba(201,169,98, 0.3);
}

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

/* Removed .hub-card-icon and its hover effect as per user request to delete emojis */

.hub-card-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.hub-card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
    max-width: 220px;
}

.hub-privacy {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 48px;
}

/* Page with Sidebar Ads Layout */
.page-with-ads {
    display: flex;
    justify-content: center;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.sidebar-ad {
    display: none;
    flex-shrink: 0;
    width: 120px;
    position: sticky;
    top: 100px;
    height: fit-content;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.sidebar-ad:hover {
    opacity: 1;
}


/* Cookie Consent Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 16px 24px;
    z-index: 9999;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.5s ease-out;
}

.cookie-content {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.cookie-content p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
    color: #e0e0e0;
}

.cookie-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cookie-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .cookie-banner {
        /* Ensure it sits above the mobile ad if both are present, or adjust position */
        bottom: 50px;
        /* Space for mobile ad if needed */
    }

    /* If mobile ad is closed or not present, JS can adjust this, 
       but for now we stack it. Or we can just let it overlay. 
       Let's stick to bottom:0 by default effectively, 
       but since mobile-footer-ad is also fixed bottom, 
       we might want to put this ABOVE it or merge them.
       Ad is bottom:0. Banner above it. */
    .cookie-banner {
        bottom: 0;
        /* Let's keep it 0, logic in JS can handle overlap or user handles it */
        /* Actually, if ad is sticky bottom, cookie banner might cover it. 
           User usually closes one. */
        padding: 12px 16px;
    }

    .cookie-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
}

.sidebar-ad img {
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

/* Show sidebar ads only on wide screens (PC) */
@media (min-width: 1400px) {
    .sidebar-ad {
        display: block;
    }
}

/* Hide ads for non-Japanese users (controlled by JS) */
.sidebar-ad.hidden {
    display: none !important;
}

/* Mobile Sticky Footer Ad */
.mobile-footer-ad {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 8px;
    justify-content: center;
    align-items: center;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

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

.mobile-footer-ad img {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

.mobile-ad-close {
    position: absolute;
    top: -12px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.mobile-ad-close:hover {
    background: var(--text-muted);
    color: white;
}

/* Show mobile footer ad only on smaller screens */
@media (max-width: 1399px) {
    .mobile-footer-ad {
        display: flex;
    }

    /* Add padding to body to prevent content from being hidden behind ad */
    body {
        padding-bottom: 70px;
    }
}

.mobile-footer-ad.hidden {
    display: none !important;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
    flex: 1;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 24px;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.03em;
}

/* Service Selector */
/* Service Selector */
.service-selector {
    margin-bottom: 24px;
    text-align: center;
}

.service-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 20px;
    letter-spacing: 0.05em;
}

.service-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-bottom: 24px;
}

.service-option {
    cursor: pointer;
    position: relative;
}

.service-option input {
    display: none;
}

.service-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 120px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    letter-spacing: 0.03em;
}

/* Hover State */
.service-option:hover .service-btn {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
}

/* Checked State */
.service-option input:checked+.service-btn {
    border-color: transparent;
    background: linear-gradient(135deg, #ffffff 0%, #fcfbf8 100%);
    color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary), 0 8px 24px rgba(201, 169, 98, 0.25);
    transform: translateY(-2px);
}

/* Premium Glow Effect on Checked */
.service-option input:checked+.service-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    box-shadow: 0 0 15px rgba(201, 169, 98, 0.15);
    z-index: -1;
}

.custom-size-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.custom-size-input input {
    width: 80px;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    text-align: center;
}

.custom-size-input input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.custom-size-unit {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.current-limit {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.current-limit strong {
    color: var(--accent-primary);
}

/* Service Info */
.service-info {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(201, 169, 98, 0.08);
    border: 1px solid rgba(201, 169, 98, 0.2);
    border-radius: 8px;
    text-align: center;
}

.service-info-item {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.info-label {
    color: var(--text-muted);
    font-weight: 500;
}

.info-divider {
    margin: 0 8px;
    color: var(--border-color);
}

/* Format Selector (subtle) */
.format-selector {
    margin-top: 12px;
    margin-bottom: 8px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.format-selector:hover {
    opacity: 1;
}

.format-label {
    display: inline;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 8px;
}

.format-options {
    display: inline-flex;
    gap: 8px;
}

.format-option {
    cursor: pointer;
}

.format-option input {
    display: none;
}

.format-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.format-option input:checked+.format-btn {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.format-option:hover .format-btn {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

/* Custom Size Input */
.custom-size-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}

.custom-size-input input {
    width: 70px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.95rem;
    text-align: center;
}

.custom-size-input input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.custom-size-unit {
    font-size: 1.05rem;
    color: var(--text-muted);
}

.recommended {
    font-size: 0.55rem;
    padding: 1px 4px;
    background: var(--text-muted);
    color: var(--bg-primary);
    border-radius: 3px;
    font-weight: 600;
}

/* Settings Panel */
.settings-panel {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.setting-item input,
.setting-item select {
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid var(--accent-secondary);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    min-width: 150px;
    transition: all 0.3s ease;
}

.setting-item input:focus,
.setting-item select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2);
}

/* Service Info */
.service-info {
    margin-top: 20px;
    margin-bottom: 8px;
    border: none;
    background: transparent;
}

.service-info-item {
    background: rgba(201, 169, 98, 0.08);
    border: 1px solid rgba(201, 169, 98, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.info-label {
    color: var(--accent-primary);
    font-weight: 500;
}

.info-divider {
    margin: 0 8px;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--bg-card);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.03) 0%, rgba(201, 169, 98, 0.08) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
}

.drop-zone.drag-over {
    transform: scale(1.02);
    border-width: 2px;
    animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {

    0%,
    100% {
        border-color: var(--accent-primary);
        box-shadow: 0 0 0 0 rgba(201, 169, 98, 0.4);
    }

    50% {
        border-color: var(--accent-secondary);
        box-shadow: 0 0 20px 5px rgba(201, 169, 98, 0.2);
    }
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
    opacity: 1;
}

.drop-zone.drag-over::before {
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.08) 0%, rgba(201, 169, 98, 0.15) 50%, rgba(201, 169, 98, 0.08) 100%);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

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

.drop-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    opacity: 0.8;
}

.drop-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.drop-subtext {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.file-select-btn {
    display: inline-block;
    padding: 14px 36px;
    background: var(--accent-secondary);
    color: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
}

.file-select-btn:hover {
    background: #333333;
    box-shadow: var(--shadow);
}

.processing-indicator {
    display: none;
    text-align: center;
    padding: 40px 30px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    margin: 20px 0;
    animation: fadeIn 0.4s ease-out;
}

.processing-indicator.active {
    display: block;
}

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

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-text {
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.03em;
    animation: pulseText 2s infinite ease-in-out;
}

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

.progress-count {
    font-size: 0.9rem;
    color: var(--accent-primary);
    font-weight: 700;
    background: rgba(201, 169, 98, 0.1);
    padding: 2px 10px;
    border-radius: 20px;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #c9a962, #e8d5a3, #c9a962);
    background-size: 200% 100%;
    border-radius: 5px;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.1, 0.7, 0.1, 1);
    animation: shimmer 2s infinite linear;
    box-shadow: 0 0 15px rgba(201, 169, 98, 0.4);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-file {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Results Container */
.results-container {
    display: none;
    margin-top: 40px;
}

.results-container.active {
    display: block;
}

.results-container h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    text-align: center;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Result Card */
.result-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    gap: 24px;
    align-items: center;
    box-shadow: var(--shadow);
    animation: slideIn 0.4s ease;
}

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

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

.result-preview {
    width: 200px;
    height: 112px;
    object-fit: cover;
    border-radius: 10px;
    background: var(--bg-secondary);
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-width: 0; /* 長ファイル名のオーバーフロー防止 */
}

.result-filename {
    font-weight: 600;
    font-size: 1.1rem;
    word-break: break-all;
}

.result-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    font-size: 1rem;
}

/* Result Note */
.result-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Accordion */
.accordion-container {
    max-width: 600px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
}

.accordion-trigger {
    width: 100%;
    padding: 8px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.accordion-trigger:hover {
    background: rgba(201, 169, 98, 0.05);
    color: var(--text-primary);
}

.accordion-icon {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.accordion-trigger.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(201, 169, 98, 0.03);
}

.accordion-content.active {
    max-height: 500px;
    /* Adjust based on content */
    border-top: 1px solid var(--border-color);
}

.accordion-inner {
    padding: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    text-align: left;
}

.accordion-inner > strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.accordion-inner p {
    margin-bottom: 8px;
}

.accordion-inner p:last-child {
    margin-bottom: 0;
}

/* Tech Info (below drop zone) */
.tech-info {
    margin-top: 16px;
    margin-bottom: 0;
}

/* Audio / Video / PDF Reset Button */
.audio-reset-btn,
.video-reset-btn,
.pdf-reset-btn {
    display: block;
    margin: 24px auto 0;
    padding: 12px 32px;
    background: var(--accent-secondary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: all 0.2s ease;
}

.audio-reset-btn:hover,
.video-reset-btn:hover,
.pdf-reset-btn:hover {
    background: #333333;
    box-shadow: var(--shadow);
}

/* Video Cancel Button */
.video-cancel-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 20px;
    background: transparent;
    border: 1px solid #cc4444;
    border-radius: 8px;
    color: #cc4444;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-cancel-btn:hover {
    background: #cc4444;
    color: #ffffff;
}



.stat-value.success {
    color: var(--success);
}

.stat-value.reduction {
    color: var(--accent-primary);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.download-btn,
.result-download-btn {
    padding: 12px 24px;
    background: var(--accent-secondary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.download-btn:hover,
.result-download-btn:hover {
    background: #333333;
    box-shadow: var(--shadow);
}

/* サイズ比較: 元サイズ → 圧縮後 -X%（音声・動画・PDF 共通） */
.result-size-compare {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.result-original {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.result-arrow {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.result-compressed {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--success);
}

.result-reduction {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.result-reduction.positive {
    color: var(--accent-primary);
    font-weight: 700;
    background: transparent;
}

/* メタ情報（ビットレート・形式・再生時間 etc.） */
.result-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0;
}

/* エラー表示 */
.result-error {
    font-size: 0.9rem;
    color: #e74c3c;
}

.download-all-btn {
    margin-top: 32px;
    padding: 14px 36px;
    background: var(--accent-secondary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    transition: all 0.3s ease;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.download-all-btn:hover {
    background: #333333;
    box-shadow: var(--shadow);
}

/* Skipped Card */
.skipped-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Slightly tighter gap */
    padding: 10px 16px;
    /* Match vertical padding with badge */
    background: rgba(201, 169, 98, 0.1);
    border-radius: 10px;
    border-left: 4px solid var(--accent-primary);
}

.skipped-icon {
    font-size: 1.2rem;
    /* Reduce size to match badge height better */
    color: var(--accent-primary);
}

.skipped-text {
    font-weight: 600;
    color: var(--accent-primary);
}

.skipped-badge {
    padding: 10px 20px;
    background: rgba(201, 169, 98, 0.15);
    color: var(--accent-primary);
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Override success color within skipped card to match theme */
.skipped-card .stat-value.success {
    color: var(--accent-primary);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 16px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-lang {
    margin-top: 16px;
}

.footer-lang select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.footer-lang select:hover,
.footer-lang select:focus {
    border-color: var(--text-secondary);
}

.footer-privacy {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 24px;
}

.footer-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.footer-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    font-size: 0.8rem;
    opacity: 0.6;
}

.footer-copyright {
    margin: 0;
}

.footer-links {
    margin: 0;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
    opacity: 1;
}

/* Terms Page Styles */
.terms-wrapper {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 24px;
}

.terms-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 64px;
    border: 1px solid var(--border-color);
}

.terms-title {
    text-align: center;
    margin-bottom: 48px;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 24px;
}

.terms-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.terms-section {
    margin-bottom: 40px;
}

.terms-section h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.terms-section h2::before {
    content: '';
    display: block;
    width: 4px;
    height: 24px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.terms-section p,
.terms-section li {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.terms-section ul {
    padding-left: 24px;
    margin-bottom: 12px;
}

.terms-section li {
    margin-bottom: 8px;
}

.last-updated {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 40px;
    margin-top: -32px;
}


/* Share Buttons (Icon only) */
.share-container {
    margin: 0;
    /* Reset margin for inline use */
    text-align: center;
}

.share-buttons {
    /* No longer needed if single button, but kept for structure */
    display: flex;
    justify-content: center;
}

.share-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    /* Circle */
    color: var(--text-muted);
    /* Muted color by default */
    background-color: rgba(255, 255, 255, 0.05);
    text-decoration: none;
    transition: all 0.2s ease;
}

.share-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.share-btn:hover {
    transform: translateY(-2px);
    color: white;
    /* Bright on hover */
    background-color: #000000;
    /* X Brand color on hover */
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    color: var(--text-primary);
}

.toast.error {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.toast.success {
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.toast.warning {
    border-color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 1.2rem;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@media (max-width: 480px) {
    .share-buttons {
        gap: 0.8rem;
    }

    /* Keep share button size fixed on mobile */
    .share-btn {
        width: 32px;
        height: 32px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }

    .result-card {
        flex-direction: column;
        text-align: center;
    }

    .result-preview {
        margin: 0 auto;
    }

    .result-stats {
        justify-content: center;
    }

    .result-size-compare {
        justify-content: center;
    }

    .result-download-btn {
        width: 100%;
    }

    .settings-panel {
        flex-direction: column;
        align-items: center;
    }
}

/* =========================================
   Article / Guide Styles
   ========================================= */
.article-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    line-height: 1.8;
    color: var(--text-color);
}

.article-header {
    margin-bottom: 40px;
    text-align: center;
}

.article-title {
    font-size: 2rem;
    margin-bottom: 16px;
}

.article-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.article-content h2 {
    font-size: 1.5rem;
    margin: 40px 0 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.article-content h3 {
    font-size: 1.25rem;
    margin: 30px 0 15px;
    font-weight: 600;
}

.article-content p {
    margin-bottom: 20px;
}

.article-content ul {
    margin-bottom: 20px;
    padding-left: 20px;
}

.article-content li {
    margin-bottom: 10px;
}

.highlight-box {
    background: var(--surface-color);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin: 30px 0;
}

/* CTA Section - Premium Design */
.cta-box {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
    padding: 48px 32px;
    border-radius: 20px;
    text-align: center;
    margin: 60px 0;
    overflow: hidden;
    border: 1px solid rgba(201, 169, 98, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.cta-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #c9a962, transparent);
}

.cta-box::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 20%, rgba(201, 169, 98, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.cta-box h2 {
    position: relative;
    z-index: 1;
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}

.cta-box p {
    position: relative;
    z-index: 1;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.cta-btn {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #c9a962 0%, #d4b977 100%);
    color: #1a1a2e;
    padding: 16px 36px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(201, 169, 98, 0.4);
}

.cta-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(201, 169, 98, 0.5);
}

.cta-btn::after {
    content: '→';
    transition: transform 0.3s ease;
}

.cta-btn:hover::after {
    transform: translateX(4px);
}

.breadcrumb {
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Guide: Image Formats specific */
.compare-table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
}

.compare-table th,
.compare-table td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
}

.compare-table th {
    background: var(--surface-color);
    font-weight: 700;
}

/* Guide: SNS Sizes specific */
.size-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.size-header {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--primary-color);
}


.article-content {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}





/* Article/Guide Typography & Layout */
.article-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    line-height: 1.8;
    color: var(--text-color);
}

.article-header {
    margin-bottom: 40px;
    text-align: center;
}

.article-title {
    font-size: 2rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.article-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Headings within article content */
.article-content h2 {
    font-size: 1.5rem;
    margin: 40px 0 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    color: var(--text-primary);
}

.article-content h3 {
    font-size: 1.25rem;
    margin: 30px 0 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.article-content p {
    margin-bottom: 20px;
}

.article-content ul {
    margin-bottom: 20px;
    padding-left: 20px;
}

.article-content li {
    margin-bottom: 10px;
}

/* Highlight Box */
.highlight-box {
    background: var(--surface-color);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin: 30px 0;
}


/* Fix: Override CTA box styles to ensure they take precedence over article styles */
.cta-box h2 {
    color: #ffffff !important;
    border-bottom: none !important;
    /* Remove article h2 border */
}

.cta-box p {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Accordion Styles */
.accordion-container {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 30px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    transition: border-color 0.3s ease;
}

.accordion-container:hover {
    border-color: var(--primary-color);
}

.accordion-trigger {
    width: 100%;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-color);
    font-weight: 600;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    text-align: center;
    position: relative;
}

.accordion-trigger:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary-color);
}



.accordion-trigger:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.accordion-icon {
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    /* Position icon absolutely */
    right: 20px;
    /* Stick to right */
}

.accordion-trigger.active .accordion-icon {
    transform: rotate(180deg);
    color: var(--primary-color);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: transparent;
}

.accordion-content.active {
    max-height: 500px;
}

.accordion-inner {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* ffmpeg.wasm 初期化ステータス */
.ffmpeg-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.ffmpeg-error {
    text-align: center;
    padding: 24px 20px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    color: #dc2626;
}

.ffmpeg-error small {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    word-break: break-all;
}

