/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-alt: #f9fafb;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-rgb: 99, 102, 241;
  --primary-muted: rgba(99, 102, 241, 0.08);
  --primary-muted-hover: rgba(99, 102, 241, 0.14);
  --text: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-primary: rgba(99, 102, 241, 0.35);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.09), 0 4px 12px rgba(0,0,0,0.04);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 5px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
}

body.dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-alt: #162032;
  --primary: #818cf8;
  --primary-dark: #6366f1;
  --primary-rgb: 129, 140, 248;
  --primary-muted: rgba(129, 140, 248, 0.1);
  --primary-muted-hover: rgba(129, 140, 248, 0.17);
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --border: #2d3f57;
  --border-primary: rgba(129, 140, 248, 0.35);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.2);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.45), 0 4px 12px rgba(0,0,0,0.2);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  min-width: 360px;
  transition: background-color 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
}

/* ── Site Header ────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.3s, border-color 0.3s;
}

.site-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.site-brand-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: block;
}

.site-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  transition: color 0.3s;
}

.site-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.github-link {
  display: flex;
  align-items: center;
}

.github-link img {
  display: block;
}

.theme-toggle {
  cursor: pointer;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 5px 9px;
  font-size: 15px;
  line-height: 1;
  color: var(--text);
  transition: background-color 0.15s, border-color 0.15s, color 0.3s;
}

.theme-toggle:hover {
  background-color: var(--primary-muted);
  border-color: var(--border-primary);
}

/* ── Page Content ───────────────────────────────────────────── */
.page-content {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 0;
}

/* ── Tool Wrapper ───────────────────────────────────────────── */
.tool-wrapper {
  background-color: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* ── Tool Header ────────────────────────────────────────────── */
.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 22px 28px 20px;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.3s;
}

.tool-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.2;
  transition: color 0.3s;
}

.tool-desc {
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: color 0.3s;
}

.tool-header-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background-color: var(--primary-muted);
  color: var(--primary);
  border: 1px solid var(--border-primary);
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

/* ── Tool Body ──────────────────────────────────────────────── */
.tool-body {
  display: flex;
  min-height: 520px;
}

/* ── Tool Panels ────────────────────────────────────────────── */
.tool-panel {
  display: flex;
  flex-direction: column;
  padding: 24px 28px;
}

.tool-panel--input {
  width: clamp(340px, 38%, 420px);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  transition: border-color 0.3s;
}

.tool-panel--output {
  flex: 1;
  min-width: 0;
}

/* ── Upload Zone ────────────────────────────────────────────── */
.upload-zone {
  position: relative;
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius);
  background-color: var(--primary-muted);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
  flex-shrink: 0;
}

.upload-zone:hover {
  border-color: var(--primary);
  background-color: var(--primary-muted-hover);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-zone-content {
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.upload-icon {
  color: var(--primary);
  margin-bottom: 4px;
  flex-shrink: 0;
}

.upload-zone-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: color 0.3s;
}

.upload-zone-hint {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  transition: color 0.3s;
}

.upload-zone-paste-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  transition: color 0.3s;
}

/* ── OR Divider ─────────────────────────────────────────────── */
.or-divider {
  display: flex;
  align-items: center;
  margin: 14px 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 0.3s;
}

.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border);
  transition: background-color 0.3s;
}

.or-divider span {
  padding: 0 10px;
}

/* ── SVG Textarea ───────────────────────────────────────────── */
.textarea {
  flex: 1;
  min-height: 0;
  position: relative;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--surface-alt);
  overflow: hidden;
  transition: border-color 0.15s, background-color 0.3s;
}

.textarea.focus {
  border-color: var(--primary);
  background-color: var(--surface);
}

.textarea textarea {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 110px;
  padding: 12px 14px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  transition: color 0.3s;
}

.textarea textarea::placeholder {
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
}

/* ── Compress Section ───────────────────────────────────────── */
.compress-section {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--surface-alt);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  transition: border-color 0.3s, background-color 0.3s;
}

.compress-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.compress-item label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.3s;
}

.compress-item input[type="number"] {
  width: 62px;
  padding: 4px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s, background-color 0.3s, color 0.3s;
}

.compress-item input[type="number"]:focus {
  border-color: var(--primary);
}

.compress-item input[type="range"] {
  width: 96px;
  accent-color: var(--primary);
}

.compress-item span {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 30px;
  transition: color 0.3s;
}

button#recompress {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-primary);
  background-color: transparent;
  color: var(--primary);
  cursor: pointer;
  line-height: 1.5;
  transition: background-color 0.15s, color 0.3s, border-color 0.3s;
}

button#recompress:hover {
  background-color: var(--primary-muted);
}

/* ── Action Bar ─────────────────────────────────────────────── */
.action {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  flex-shrink: 0;
}

button#convert {
  width: 100%;
  padding: 9px 26px;
  border-radius: var(--radius-sm);
  background-color: var(--primary);
  color: white;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background-color 0.15s, opacity 0.15s, transform 0.1s;
}

button#convert:hover:not([disabled]) {
  background-color: var(--primary-dark);
}

button#convert:active:not([disabled]) {
  transform: scale(0.97);
}

button#convert[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.checkbox {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  -webkit-user-select: none;
}

.checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-label {
  font-size: 13px;
  color: var(--text-secondary);
  transition: color 0.3s;
}

/* ── Output Panel ───────────────────────────────────────────── */
.output-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
  text-align: center;
  padding: 40px 24px;
  transition: color 0.3s;
}

.output-empty p {
  font-size: 14px;
  line-height: 1.7;
}

/* ── Result Section ─────────────────────────────────────────── */
.result {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.result-format {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

button.format-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-primary);
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

button.format-btn:hover:not(.format-btn--active) {
  background-color: var(--primary-muted);
}

button.format-btn.format-btn--active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ── Result Wrapper ─────────────────────────────────────────── */
.result-wrapper {
  flex: 1;
  display: flex;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--surface-alt);
  overflow: hidden;
  min-height: 220px;
  transition: border-color 0.3s, background-color 0.3s;
}

.result-textarea {
  flex: 1;
  min-width: 0;
  position: relative;
}

.result-textarea textarea {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 220px;
  padding: 14px 16px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  line-height: 1.65;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  cursor: pointer;
  transition: color 0.3s;
}

.result-copy-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  padding: 3px 9px;
  border-radius: 4px;
  background-color: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.result-textarea:hover .result-copy-hint {
  opacity: 1;
}

.result-thumb {
  width: 150px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background-color: var(--surface);
  transition: border-color 0.3s, background-color 0.3s;
}

.result-thumb img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: var(--radius-xs);
}

/* ── Batch Results ──────────────────────────────────────────── */
.batch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

#batch-count {
  font-size: 13px;
  color: var(--text-secondary);
  transition: color 0.3s;
}

button#copy-all {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  background-color: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s;
}

button#copy-all:hover {
  background-color: var(--primary-dark);
}

#batch-list {
  flex: 1;
  overflow-y: auto;
}

.batch-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  transition: border-color 0.15s, background-color 0.3s;
}

.batch-item:hover {
  border-color: var(--border-primary);
}

.batch-thumb {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: var(--radius-xs);
  background-color: var(--border);
}

.batch-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.batch-name {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s;
}

.batch-output {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  outline: none;
  padding: 7px 9px;
  border-radius: var(--radius-xs);
  background-color: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  cursor: pointer;
  min-height: 54px;
  transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}

/* ── History Section ────────────────────────────────────────── */
.history-outer {
  margin-top: 32px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 20px 24px 24px;
  transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.history-section {
  padding: 0;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.history-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  transition: color 0.3s;
}

.history-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

button#view-more-history {
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  background-color: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  line-height: 1.5;
  transition: background-color 0.15s;
}

button#view-more-history:hover {
  background-color: var(--primary-dark);
}

button#clear-history {
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  background-color: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  cursor: pointer;
  line-height: 1.5;
  transition: background-color 0.15s, border-color 0.3s, color 0.3s;
}

button#clear-history:hover {
  background-color: var(--primary-muted);
  border-color: var(--border-primary);
  color: var(--primary);
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  padding-bottom: 4px;
}

.history-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.15s, background-color 0.3s;
}

.history-item:hover {
  border-color: var(--border-primary);
}

.history-thumb {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: var(--radius-xs);
  background-color: var(--surface-alt);
}

.history-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s;
}

.history-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
  transition: color 0.3s;
}

button.history-copy-btn {
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  background-color: var(--primary-muted);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border-primary);
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1.5;
  transition: background-color 0.15s, color 0.15s;
}

button.history-copy-btn:hover {
  background-color: var(--primary);
  color: white;
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  margin-top: 32px;
  border-top: 1px solid var(--border);
  transition: border-color 0.3s;
}

.site-footer-inner {
  padding: 20px 0 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.3s;
}

/* ── Toast ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

.toast {
  margin-top: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
  color: white;
  background-color: #1f2937;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: auto;
  max-width: 280px;
  word-break: break-all;
}

.toast--show {
  opacity: 1;
  transform: translateX(0);
}

.toast--success { background-color: #059669; }
.toast--error   { background-color: #dc2626; }
.toast--warning { background-color: #d97706; }

/* ── Drawer ─────────────────────────────────────────────────── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.drawer-overlay--show {
  display: block;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 92vw;
  height: 100vh;
  background-color: var(--surface);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s;
}

.drawer--open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  transition: border-color 0.3s;
}

.drawer-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  transition: color 0.3s;
}

button#drawer-close {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 400;
  padding: 3px 8px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

button#drawer-close:hover {
  color: var(--text);
  border-color: var(--border-primary);
  background-color: var(--primary-muted);
}

.drawer-search {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  transition: border-color 0.3s;
}

#history-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--surface-alt);
  color: var(--text);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s, background-color 0.3s, color 0.3s;
}

#history-search:focus {
  border-color: var(--primary);
  background-color: var(--surface);
}

#history-search::placeholder {
  color: var(--text-muted);
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-group-title {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 14px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  transition: color 0.3s;
}

.drawer-empty {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 48px 0;
  transition: color 0.3s;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  .tool-body {
    flex-direction: column;
  }

  .tool-panel--input {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .tool-panel--output {
    min-height: 260px;
  }

  .tool-header-badges {
    display: none;
  }
}

@media (max-width: 720px) {
  .tool-header {
    padding: 18px 22px 16px;
  }

  .tool-panel {
    padding: 20px 22px;
  }

  .history-outer {
    padding: 16px 18px 20px;
  }
}

@media (max-width: 600px) {
  .page-content {
    padding: 20px 16px 0;
  }

  .site-header-inner {
    padding: 0 16px;
  }

  .tool-header {
    padding: 16px 18px 14px;
  }

  .tool-panel {
    padding: 18px 18px;
  }

  .tool-title {
    font-size: 18px;
  }

  .history-outer {
    padding: 14px 16px 18px;
  }

  .history-list {
    grid-template-columns: 1fr;
  }

  .usage-card {
    padding: 16px;
  }

  .usage-card h3 {
    font-size: 13px;
  }

  .usage-card p {
    font-size: 12px;
  }
}

/* ── Upload file preview ────────────────────────────────────── */
.upload-zone--has-files .upload-icon,
.upload-zone--has-files .upload-zone-title,
.upload-zone--has-files .upload-zone-paste-hint { display: none; }

.upload-zone--has-files .upload-zone-hint {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
}

.upload-zone--has-files .upload-zone-content {
  padding: 10px 14px;
}

.file-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  min-width: 0;
  max-width: 100%;
  transition: border-color 0.15s, background-color 0.3s;
}

.file-card:hover { border-color: var(--border-primary); }

.file-card-thumb {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 4px;
  background: var(--surface-alt);
  flex-shrink: 0;
}

.file-card-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s;
}

.file-card-remove {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--text-muted);
  color: white;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  line-height: 18px;
  text-align: center;
  padding: 0;
  transition: background-color 0.15s;
}

.file-card-remove:hover { background: #ef4444; }

/* ── History card (updated layout) ─────────────────────────── */
.history-item { align-items: flex-start; }

.history-info {
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.history-info-top {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.history-name { flex: 1; }

.history-params {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.3s, background-color 0.3s, border-color 0.3s;
}

.history-delete-btn {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  border: 1px solid var(--border);
  cursor: pointer;
  line-height: 1.6;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.history-delete-btn:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
}

.history-copy-btns {
  display: flex;
  gap: 4px;
}

button.history-copy-btn {
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--primary-muted);
  color: var(--primary);
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--border-primary);
  cursor: pointer;
  line-height: 1.6;
  transition: background-color 0.15s, color 0.15s;
}

button.history-copy-btn:hover {
  background: var(--primary);
  color: white;
}

button.history-quick-copy-btn {
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--surface);
  color: var(--primary);
  font-size: 10px;
  font-weight: 500;
  border: 1px solid var(--border);
  cursor: pointer;
  line-height: 1.6;
  transition: background-color 0.15s, border-color 0.15s;
}
button.history-quick-copy-btn:hover {
  background: var(--primary-muted);
  border-color: var(--border-primary);
}

/* ── Storage indicator ──────────────────────────────────────── */
.storage-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin-left: 8px;
  vertical-align: middle;
  transition: color 0.3s, border-color 0.3s;
}

/* ── Batch collapse toggle ──────────────────────────────────── */
.batch-toggle-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 7px 0;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-primary);
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.15s, color 0.15s;
}
.batch-toggle-btn:hover {
  background: var(--primary-muted);
}

/* ── Result copy button ─────────────────────────────────────── */
.result-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 14px;
  border-radius: var(--radius-xs);
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  z-index: 1;
  transition: background-color 0.15s, opacity 0.15s;
  opacity: 0;
}
.result-textarea:hover .result-copy-btn { opacity: 1; }

.result-download-btn {
  position: absolute;
  top: 44px;
  right: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-primary);
  cursor: pointer;
  z-index: 1;
  transition: background-color 0.15s, opacity 0.15s;
  opacity: 0;
}
.result-textarea:hover .result-download-btn { opacity: 1; }

/* ── Result meta (type + size) ──────────────────────────────── */
.result-meta {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.result-type-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
  color: white;
}
.result-type-badge--png  { background: #3b82f6; }
.result-type-badge--jpg,
.result-type-badge--jpeg { background: #f59e0b; }
.result-type-badge--svg  { background: #8b5cf6; }
.result-type-badge--gif  { background: #10b981; }
.result-type-badge--webp { background: #06b6d4; }
.result-type-badge--unknown { background: var(--text-muted); }

.result-size-display {
  font-size: 12px;
  color: var(--text-secondary);
  transition: color 0.3s;
}

/* ── SVG-only format indicator ──────────────────────────────── */
.result-format-svg {
  display: none;
  margin-bottom: 14px;
  flex-shrink: 0;
}

/* ── Batch item size ────────────────────────────────────────── */
.batch-size {
  font-size: 11px;
  color: var(--text-muted);
  transition: color 0.3s;
}

/* ── Input tabs ─────────────────────────────────────────────── */
.input-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  transition: border-color 0.3s;
}
.input-tab {
  flex: 1;
  padding: 8px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.input-tab:hover { color: var(--primary); }
.input-tab--active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-pane { display: block; }

/* ── Compress-section sub-items ─────────────────────────────── */
.compress-item#quality-item,
.compress-item#double-quote-item {
  display: none;
}

/* ── Result type badge colors ────────────────────────────────── */
.result-type-badge--avif { background: #10b981; }
.result-type-badge--bmp  { background: #ef4444; }
.result-type-badge--ico  { background: #6b7280; }
.result-type-badge--gif  { background: #f97316; }
.result-type-badge--webp { background: #06b6d4; }

/* ── Usage section ───────────────────────────────────────────── */
.usage-section { margin: 32px auto 0; }
.usage-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 0; }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.usage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  transition: border-color 0.3s, background 0.3s;
}
.usage-card-icon { font-size: 24px; margin-bottom: 10px; }
.usage-card h3 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.usage-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }
