/* 新しいトーンのクリーンデザイン */
:root {
    --bg: #f6f7fb;
    --card: #ffffff;
    --primary: #2f6adf;
    --primary-strong: #1f4ead;
    --accent: #1ac6b1;
    --text: #1c2433;
    --muted: #6a7280;
    --border: #e4e8f0;
    --shadow: 0 10px 28px rgba(16, 30, 56, 0.08);
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', 'Noto Sans JP', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px 64px;
}

.hero {
    text-align: center;
    margin-bottom: 24px;
}

.badge-sub {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(75, 156, 226, 0.12);
    color: #2a6aa6;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
}

.badge-sub::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
}

.hero-lead {
    margin: 14px 0 4px;
    color: #2b3a4c;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.hero-title {
    margin: 4px 0 6px;
    font-size: 32px;
    color: #111827;
    letter-spacing: 0.01em;
}

.hero-subtext {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.container {
    width: 100%;
    max-width: 1160px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.step-card {
    position: relative;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 20px;
    border: 1px solid var(--border);
}

.step-title {
    margin: 0 0 8px;
    font-size: 22px;
    color: #182335;
}

.step-desc {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 15px;
}

.quality-control {
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid #e2e7f1;
    border-radius: 12px;
    background: #f7f9fc;
}

.quality-control label {
    font-weight: 700;
    color: #1f2a3d;
}

.quality-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

#quality-input {
    flex: 1;
    accent-color: var(--primary);
}

#quality-value {
    min-width: 46px;
    text-align: right;
    font-weight: 800;
    color: var(--primary-strong);
}

.quality-row .btn-tertiary {
    white-space: nowrap;
    min-width: 180px;
}

.progress-wrap {
    margin: 6px 0 18px;
    display: grid;
    gap: 6px;
}

.progress-label {
    font-size: 14px;
    color: #2b3e5a;
    font-weight: 700;
}

.progress-track {
    position: relative;
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #e7ebf5;
    overflow: hidden;
}

.progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    transition: width 0.15s ease;
}

.progress-bar.indeterminate {
    width: 50%;
    animation: progress-indeterminate 1s linear infinite;
}

.drop-area {
    border: 1.5px dashed #cfd6e4;
    border-radius: var(--radius);
    background: #f9fbff;
    padding: 30px 16px;
    margin-bottom: 12px;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
}

.drop-area.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47, 106, 223, 0.16);
    transform: translateY(-1px);
}

.drop-area[data-loading]::before {
    content: attr(data-loading);
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(17, 28, 46, 0.08);
    backdrop-filter: blur(2px);
    color: #0f1a2e;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.drop-inner {
    max-width: 540px;
    margin: 0 auto;
}

.cloud-icon {
    display: none;
}

.cloud-icon .arrow {
    display: none;
}

.drop-text {
    margin: 12px 0;
    color: #40526b;
    line-height: 1.6;
}

.limit-text {
    margin-top: 12px;
    font-size: 13px;
    color: var(--muted);
}

.btn-primary,
.btn-secondary {
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.06s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(47, 106, 223, 0.25);
}

.btn-secondary {
    background: #eef1f7;
    color: #1c2433;
    box-shadow: inset 0 1px 0 #fff, 0 6px 14px rgba(17, 27, 46, 0.06);
}

.btn-tertiary {
    border: 1px solid #d9deea;
    border-radius: 10px;
    padding: 10px 14px;
    background: #f4f6fb;
    color: #1f2b3b;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.06s ease;
    
}

.file-card .btn-tertiary {
    width: 100%;
}

.btn-tertiary:hover {
    filter: brightness(1.03);
}

.btn-tertiary:active {
    transform: translateY(1px);
}

.btn-tertiary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary:not(:disabled):hover,
.btn-secondary:not(:disabled):hover {
    filter: brightness(1.02);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary:not(:disabled):active,
.btn-secondary:not(:disabled):active {
    transform: translateY(1px);
}

.file-list-header {
    margin: 18px 0 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-list-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.file-list-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.link-button {
    background: none;
    border: none;
    color: #3a7ed1;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
}

.link-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    text-decoration: none;
}

.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.file-list.empty {
    display: block;
}

.file-list.skeleton {
    display: grid;
}

.placeholder {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.skeleton-card {
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #f7f9fd;
    box-shadow: 0 12px 26px rgba(24, 35, 53, 0.06);
    overflow: hidden;
}

.skeleton-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: linear-gradient(90deg, #eef2fb 25%, #f7f9ff 50%, #eef2fb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

.skeleton-info {
    padding: 12px 14px 16px;
    display: grid;
    gap: 10px;
}

.skeleton-line {
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, #eef2fb 25%, #f7f9ff 50%, #eef2fb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

.skeleton-line.short { width: 40%; }
.skeleton-line.mid { width: 65%; }
.skeleton-line.long { width: 90%; }

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

.file-card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(16, 30, 56, 0.08);
    overflow: hidden;
    border: 1px solid #e6eaf2;
    transition: transform 0.08s ease, box-shadow 0.18s ease;
}

.file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(16, 30, 56, 0.1);
}

.file-card.loading {
    pointer-events: none;
    filter: grayscale(0.2) brightness(0.98);
}

.file-card.loading::after {
    content: '再変換中...';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(14, 26, 46, 0.35);
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.04em;
    z-index: 2;
}

.file-card.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: card-shimmer 1s linear infinite;
    z-index: 1;
}

.file-card.loading .file-thumb {
    filter: blur(1px);
}

.file-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    background: #eef3fb;
}

.thumb-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: flex-end;
    padding: 8px 10px;
    background: linear-gradient(180deg, rgba(10, 17, 30, 0.5), rgba(10, 17, 30, 0));
}

.delete-btn {
    background: rgba(0,0,0,0.45);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
}

.file-info {
    padding: 12px 14px 16px;
}

.size-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #1f2a3d;
}

.size-row small {
    display: block;
    font-weight: 600;
    color: #738099;
    font-size: 11px;
}

.badge-save {
    margin-left: auto;
    background: #e9f5ff;
    color: #14548f;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10px;
    border: 1px solid #c7def5;
}

.download-row {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.quality-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    /* padding: 4px 8px; */
    /* border-radius: 999px; */
    /* background: #eef2fb; */
    color: #1c2433;
    font-weight: 700;
    /* border: 1px solid #d8def0; */
    font-size: 10px;
}

.download-row a {
    flex: 1;
    text-align: center;
    text-decoration: none;
    background: #f3f5fa;
    color: #1f2b3b;
    padding: 10px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    transition: filter 0.15s ease, transform 0.06s ease;
}

.download-row a:hover {
    filter: brightness(1.02);
}

.download-row a.primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(47, 106, 223, 0.22);
}

.file-meta {
    margin-top: 8px;
    color: #7a8599;
    font-size: 13px;
    letter-spacing: 0.01em;
}

.action-row {
    margin-top: 10px;
}

.download-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.disabled-link {
    pointer-events: none;
    filter: grayscale(0.7);
    opacity: 0.6;
}

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

@keyframes progress-indeterminate {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(150%); }
}

@media (max-width: 768px) {
    .page { padding: 24px 12px 48px; }
    .step-card { padding: 22px 16px 22px 60px; }
    .file-list { grid-template-columns: 1fr; }
    .hero-title { font-size: 28px; }
}

