*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: #f0f4f8; color: #333; line-height: 1.7; min-height: 100vh;
}
.container { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* Header */
header { background: linear-gradient(135deg, #4f8cff, #2563eb); color: #fff; padding: 28px 0 20px; text-align: center; }
header h1 { font-size: 1.8rem; margin-bottom: 6px; }
.subtitle { font-size: 0.92rem; opacity: 0.9; }

/* Layout */
.page-body { max-width: 760px; margin: 0 auto; padding: 0 8px; }
.page-body > main { max-width: 720px; }

/* Step sections */
.step-section {
  background: #fff; border-radius: 18px; padding: 24px 22px;
  margin-bottom: 16px; box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  position: relative;
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; background: #2563eb; color: #fff;
  border-radius: 50%; font-size: 0.85rem; font-weight: 800;
  margin-bottom: 8px;
}
.step-title { font-size: 1.25rem; font-weight: 800; margin-bottom: 6px; color: #1a1a1a; }
.step-desc { font-size: 0.92rem; color: #888; margin-bottom: 16px; }

/* Drop zone */
.drop-zone {
  padding: 44px 20px; border: 3px dashed #93b4ff; border-radius: 16px;
  background: #f7faff; text-align: center; cursor: pointer; transition: all 0.3s;
}
.drop-zone:hover, .drop-zone.drag-over {
  background: #e0ecff; border-color: #2563eb; transform: scale(1.01);
}
.drop-icon { font-size: 48px; margin-bottom: 10px; }
.drop-text { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; color: #333; }
.drop-subtext { color: #bbb; margin-bottom: 12px; font-size: 0.88rem; }
.file-btn {
  display: inline-block; padding: 14px 40px;
  background: linear-gradient(135deg, #4f8cff, #2563eb);
  color: #fff; border: none; border-radius: 12px;
  font-size: 1.1rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 3px 12px rgba(37,99,235,0.2);
  transition: opacity 0.2s, transform 0.1s;
}
.file-btn:hover { opacity: 0.9; }
.file-btn:active { transform: scale(0.97); }
.drop-hint { margin-top: 14px; font-size: 0.8rem; color: #bbb; }

/* File list */
.file-list-section { padding: 16px 22px; }
.file-list-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.file-count { font-size: 0.95rem; font-weight: 700; color: #333; }
.clear-all-btn {
  padding: 6px 16px; background: #fee2e2; color: #dc2626; border: none;
  border-radius: 8px; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
}
.clear-all-btn:hover { background: #dc2626; color: #fff; }

.file-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid #f3f3f3;
}
.file-item:last-child { border-bottom: none; }
.file-item-thumb {
  width: 44px; height: 44px; border-radius: 8px; object-fit: cover;
  background: #f0f0f0; flex-shrink: 0;
}
.file-item-thumb-placeholder {
  width: 44px; height: 44px; border-radius: 8px; flex-shrink: 0;
  background: #f0f0f0; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: #ccc;
}
.file-item-info { flex: 1; min-width: 0; }
.file-item-name { font-weight: 600; font-size: 0.85rem; word-break: break-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item-meta { font-size: 0.75rem; color: #aaa; }
.file-item-badge {
  padding: 2px 8px; border-radius: 12px; font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}
.badge-heic { background: #fef3c7; color: #92400e; }
.badge-jpeg { background: #d1fae5; color: #065f46; }
.badge-png  { background: #dbeafe; color: #1e40af; }
.badge-webp { background: #ede9fe; color: #5b21b6; }
.badge-gif  { background: #fce7f3; color: #9d174d; }
.badge-bmp  { background: #e5e7eb; color: #374151; }
.badge-tiff { background: #fef3c7; color: #78350f; }
.badge-unknown { background: #fee2e2; color: #991b1b; }
.file-item-delete {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: #fee2e2; color: #dc2626; font-size: 0.8rem; font-weight: 700;
  cursor: pointer; flex-shrink: 0; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.file-item-delete:hover { background: #dc2626; color: #fff; }

/* Preset cards */
.preset-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px;
}
.preset-card {
  position: relative; background: #f9fafb; border: 2px solid #e5e7eb;
  border-radius: 14px; padding: 16px 10px; text-align: center;
  cursor: pointer; transition: all 0.2s; display: flex;
  flex-direction: column; align-items: center; gap: 4px;
}
.preset-card:hover { border-color: #93b4ff; background: #f0f5ff; }
.preset-card.active {
  border-color: #2563eb; background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.preset-icon { font-size: 1.8rem; }
.preset-name { font-size: 0.95rem; font-weight: 800; color: #1a1a1a; }
.preset-desc { font-size: 0.72rem; color: #aaa; line-height: 1.3; }
.preset-recommend {
  position: absolute; top: -8px; right: -4px;
  background: #f59e0b; color: #fff; font-size: 0.62rem;
  font-weight: 800; padding: 2px 8px; border-radius: 12px; display: none;
}
.preset-card.active .preset-recommend,
.preset-card:first-child .preset-recommend { display: inline-block; }

/* Size presets */
.size-preset-section { margin: 16px 0; }
.sub-heading { font-size: 0.95rem; font-weight: 700; margin-bottom: 8px; color: #555; }
.size-png-note {
  background: #fef3c7; color: #92400e; padding: 8px 14px;
  border-radius: 8px; font-size: 0.82rem; font-weight: 600; margin-bottom: 8px;
}
.size-preset-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.size-preset {
  flex: 1; min-width: 70px; background: #f9fafb; border: 2px solid #e5e7eb;
  border-radius: 10px; padding: 10px 8px; text-align: center;
  cursor: pointer; transition: all 0.2s;
}
.size-preset:hover { border-color: #93b4ff; }
.size-preset.active { border-color: #2563eb; background: #eff6ff; }
.size-preset-name { font-size: 0.82rem; font-weight: 700; color: #333; }
.preset-disabled { opacity: 0.3; pointer-events: none; }

/* Advanced */
.advanced-toggle {
  background: #f9fafb; border-radius: 10px; margin: 12px 0 20px; border: 1px solid #eee;
}
.advanced-toggle summary {
  padding: 12px 16px; cursor: pointer; font-weight: 600;
  font-size: 0.82rem; color: #aaa; list-style: none;
}
.advanced-toggle summary::-webkit-details-marker { display: none; }
.advanced-toggle[open] summary { border-bottom: 1px solid #eee; }
.advanced-body { padding: 16px; }
.setting-item { margin-bottom: 14px; }
.setting-item:last-child { margin-bottom: 0; }
.setting-item label { display: block; font-size: 0.88rem; font-weight: 700; margin-bottom: 6px; }
.setting-item input[type="range"] { width: 100%; accent-color: #2563eb; }
.quality-note { font-size: 0.75rem; color: #bbb; margin-top: 4px; display: none; }
.quality-note.visible { display: block; }

/* Convert button */
.convert-btn {
  width: 100%; padding: 20px; margin-top: 4px; display: flex; align-items: center;
  justify-content: center; gap: 10px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; border: none; border-radius: 16px;
  font-size: 1.3rem; font-weight: 800; cursor: pointer;
  transition: all 0.2s; box-shadow: 0 4px 18px rgba(245,158,11,0.25);
}
.convert-btn:hover { opacity: 0.92; transform: translateY(-1px); }
.convert-btn:active { transform: scale(0.98); }
.convert-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.convert-btn-icon { font-size: 1.6rem; }
.convert-btn-text { font-size: 1.3rem; }

/* Progress */
.progress-section { padding: 22px; }
.progress-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-size: 0.92rem; font-weight: 700; color: #666;
}
.progress-bar-outer { width: 100%; height: 12px; background: #e5e7eb; border-radius: 8px; overflow: hidden; }
.progress-bar-inner { height: 100%; width: 0%; background: linear-gradient(90deg, #4f8cff, #2563eb); border-radius: 8px; transition: width 0.3s; }

/* Results */
.results { text-align: center; }
.results-done { margin-bottom: 12px; }
.results-done-icon { font-size: 3rem; margin-bottom: 4px; animation: pop 0.5s ease; }
@keyframes pop { 0%{transform:scale(0.3);opacity:0} 60%{transform:scale(1.15)} 100%{transform:scale(1);opacity:1} }
.results-done-title { font-size: 1.3rem; font-weight: 800; color: #16a34a; margin-bottom: 4px; }
.results-done-desc { font-size: 0.92rem; color: #666; }

/* Summary card */
.summary-card {
  display: flex; gap: 14px; flex-wrap: wrap; margin: 16px 0;
  background: #f0fdf4; border-radius: 12px; padding: 16px 20px;
  border: 1px solid #bbf7d0; text-align: left;
}
.summary-item { display: flex; flex-direction: column; gap: 2px; min-width: 120px; flex: 1; }
.summary-label { font-size: 0.75rem; color: #666; }
.summary-value { font-size: 0.92rem; font-weight: 700; color: #333; }
.text-green { color: #16a34a; }
.text-red { color: #dc2626; }
.results-summary-text { font-size: 0.92rem; color: #666; margin-bottom: 16px; }
.results-summary-text { font-size: 0.92rem; color: #666; margin-bottom: 16px; }

.results-download-area { margin-bottom: 16px; }
.download-main-btn {
  width: 100%; padding: 22px 16px; display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff; border: none; border-radius: 16px;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 4px 18px rgba(22,163,74,0.25);
}
.download-main-btn:hover { opacity: 0.92; transform: translateY(-1px); }
.download-main-btn:active { transform: scale(0.98); }
.download-main-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.download-main-icon { font-size: 2.2rem; }
.download-main-text { font-size: 1.2rem; font-weight: 800; }
.download-main-sub { font-size: 0.78rem; opacity: 0.8; }

/* Rename area */
.rename-area {
  text-align: left; margin: 16px 0; padding: 20px;
  background: #f9fafb; border-radius: 14px; border: 1px solid #e5e7eb;
}
.rename-area .sub-heading { margin-bottom: 4px; }
.rename-area .sub-desc { font-size: 0.85rem; color: #999; margin-bottom: 14px; }
.rename-label {
  font-size: 0.9rem; font-weight: 700; color: #444;
  margin-bottom: 8px; margin-top: 14px;
}
.rename-label:first-child { margin-top: 0; }
.rename-individual { margin-top: 14px; }
.rename-bulk { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid #f0f0f0; }
.rename-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rename-input {
  flex: 1; min-width: 140px; padding: 10px 14px; border: 2px solid #e5e7eb;
  border-radius: 10px; font-size: 0.92rem;
}
.rename-input:focus { outline: none; border-color: #2563eb; }
.rename-input::placeholder { color: #ccc; }
.rename-date-label {
  display: flex; align-items: center; gap: 4px; font-size: 0.82rem;
  font-weight: 600; color: #888; cursor: pointer; white-space: nowrap;
}
.rename-date-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: #2563eb; }
.rename-apply-btn {
  padding: 10px 18px; background: #2563eb; color: #fff; border: none;
  border-radius: 8px; font-size: 0.85rem; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}
.rename-apply-btn:hover { opacity: 0.85; }
.rename-preview { margin-top: 6px; font-size: 0.78rem; color: #2563eb; font-weight: 600; min-height: 1.2em; }
.rename-item { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rename-item-thumb { width: 32px; height: 32px; border-radius: 5px; object-fit: cover; flex-shrink: 0; background: #f0f0f0; }
.rename-item-input { flex: 1; padding: 7px 10px; border: 2px solid #e5e7eb; border-radius: 7px; font-size: 0.85rem; min-width: 0; }
.rename-item-input:focus { outline: none; border-color: #2563eb; }
.rename-item-ext { font-size: 0.78rem; font-weight: 700; color: #aaa; flex-shrink: 0; }

/* Result cards */
.results-list { text-align: left; margin-top: 12px; }
.result-card {
  background: #f9fafb; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid #e5e7eb; display: flex; align-items: center; gap: 12px;
}
.result-card-error { border-color: #fecaca; background: #fef2f2; }
.result-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; background: #f0f0f0; flex-shrink: 0; }
.result-info { flex: 1; min-width: 0; }
.result-name-row { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.result-name-input {
  flex: 1; min-width: 0; padding: 4px 8px; border: 1.5px solid #e5e7eb;
  border-radius: 6px; font-size: 0.85rem; font-weight: 700; color: #333;
  background: #fff; transition: border-color 0.2s;
}
.result-name-input:focus { outline: none; border-color: #2563eb; background: #f0f5ff; }
.result-ext { font-size: 0.78rem; font-weight: 700; color: #aaa; flex-shrink: 0; }
.result-detail { font-size: 0.78rem; color: #aaa; }
.result-download {
  padding: 8px 16px; background: #2563eb; color: #fff; border: none;
  border-radius: 8px; font-weight: 700; font-size: 0.82rem;
  cursor: pointer; flex-shrink: 0;
}
.result-download:hover { opacity: 0.85; }

/* Restart */
.restart-btn {
  margin-top: 12px; padding: 12px 28px; background: none; border: 2px solid #d1d5db;
  border-radius: 12px; color: #999; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
}
.restart-btn:hover { border-color: #2563eb; color: #2563eb; }

/* Features */
.features { margin: 40px 0; }
.features h2 { text-align: center; font-size: 1.15rem; margin-bottom: 16px; font-weight: 800; }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.feature-card {
  background: #fff; border-radius: 14px; padding: 20px 14px; text-align: center;
  box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}
.feature-icon { font-size: 28px; margin-bottom: 6px; }
.feature-card h3 { font-size: 0.9rem; margin-bottom: 4px; font-weight: 700; }
.feature-card p { font-size: 0.78rem; color: #888; }

/* FAQ */
.faq { margin: 32px 0 40px; }
.faq h2 { text-align: center; font-size: 1.15rem; margin-bottom: 14px; font-weight: 800; }
.faq details {
  background: #fff; border-radius: 10px; padding: 14px 18px;
  margin-bottom: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.03); cursor: pointer;
}
.faq details summary { font-weight: 700; font-size: 0.92rem; list-style: none; color: #333; }
.faq details summary::before { content: "▶ "; font-size: 0.7rem; color: #2563eb; }
.faq details[open] summary::before { content: "▼ "; }
.faq details p { margin-top: 8px; font-size: 0.88rem; color: #666; line-height: 1.7; }

/* Ad slots */
.ad-slot { margin: 24px 0; text-align: center; min-height: 0; overflow: hidden; }
.ad-slot:empty { display: none; }
.ad-slot .adsbygoogle { margin: 0 auto; }
.ad-slot .adsbygoogle[data-ad-status="unfilled"] { display: none; }

/* Footer */
footer { background: #1e293b; color: #94a3b8; text-align: center; padding: 18px 0; font-size: 0.78rem; }

/* Responsive */
@media (max-width: 600px) {
  header h1 { font-size: 1.5rem; }
  .subtitle { font-size: 0.82rem; }
  .step-section { padding: 20px 16px; border-radius: 14px; }
  .step-title { font-size: 1.1rem; }
  .drop-zone { padding: 32px 14px; }
  .drop-icon { font-size: 40px; }
  .drop-text { font-size: 1rem; }
  .file-btn { padding: 12px 32px; font-size: 1rem; }
  .preset-cards { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .preset-card { padding: 12px 8px; }
  .preset-name { font-size: 0.82rem; }
  .preset-desc { font-size: 0.65rem; }
  .convert-btn { padding: 16px; font-size: 1.15rem; }
  .convert-btn-icon, .convert-btn-text { font-size: 1.15rem; }
  .download-main-btn { padding: 18px 14px; }
  .download-main-text { font-size: 1.05rem; }
  .result-card { flex-wrap: nowrap; }
  .features-grid { grid-template-columns: 1fr; gap: 10px; }
  .feature-card { padding: 16px 14px; }
  .file-item-thumb, .file-item-thumb-placeholder { width: 36px; height: 36px; }
  .rename-row { flex-direction: column; align-items: stretch; }
  .rename-input { min-width: 0; }
}
