/* ── Safe-area vars ─────────────────────────────────────────────────── */
:root {
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
}

/* ── Page shell ─────────────────────────────────────────────────────── */
html, body {
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: var(--safe-bottom);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* ── Toolbar — translucent PIER chrome ──────────────────────────────── */
/* min-height so the bar grows in PWA mode (env(safe-area-inset-top))
   without the contents sliding under the Dynamic Island / notch. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--toolbar-h);
  display: flex;
  align-items: center;
  gap: var(--space-10);
  padding: env(safe-area-inset-top) var(--space-12) 0 var(--space-14);
  background: rgba(28,28,30,0.72);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-bottom: 1px solid var(--separator);
}

/* Brand — Apple-style wordmark */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  color: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(10,132,255,0.25);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-system);
  line-height: 1;
}

.brand-wordmark {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--label);
  line-height: 1;
  font-family: var(--font-system);
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--label-secondary);
  line-height: 1;
  margin-left: var(--space-2);
}

/* Right-side toolbar space — reserved for future settings button */
.toolbar-spacer {
  flex: 1;
}

/* ── Hero section ───────────────────────────────────────────────────── */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem max(1rem, var(--safe-right)) 2rem max(1rem, var(--safe-left));
  background: var(--bg);
}

@media (min-width: 640px) {
  .hero { min-height: 60vh; }
}

.hero-inner {
  width: 100%;
  max-width: 640px;
  animation: fadeIn 0.35s ease both;
}

/* ── Drop zone ──────────────────────────────────────────────────────── */
.dropzone {
  background: var(--bg-secondary);
  border: 1px solid var(--separator-thin);
  border-radius: var(--radius-lg-card);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10,132,255,0.12);
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(10,132,255,0.07);
  box-shadow: 0 0 0 3px rgba(10,132,255,0.18);
}

.dropzone input[type="file"] {
  display: none;
}

.dz-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 1.25rem;
  display: block;
  color: var(--label-tertiary);
}

.dz-heading {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--label);
  margin-bottom: 0.5rem;
  font-family: var(--font-system);
}

.dz-sub {
  font-size: 0.875rem;
  color: var(--label-secondary);
  margin-bottom: 0.35rem;
  line-height: 1.5;
  font-family: var(--font-system);
}

.dz-hint {
  font-size: 0.8rem;
  color: var(--label-tertiary);
  font-family: var(--font-system);
}

/* ── Tools section ──────────────────────────────────────────────────── */
.tools-section {
  background: var(--bg-grouped);
  padding: 2.5rem max(1rem, var(--safe-right)) 4rem max(1rem, var(--safe-left));
  flex: 1;
}

.tools-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.tools-heading {
  font-family: var(--font-system);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--label-tertiary);
  margin-bottom: 1rem;
}

/* ── Tile grid ──────────────────────────────────────────────────────── */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (min-width: 540px) {
  .tile-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 960px) {
  .tile-grid { grid-template-columns: repeat(6, 1fr); }
}

/* ── Tile ────────────────────────────────────────────────────────────── */
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  background: var(--bg-secondary);
  border: 1px solid var(--separator-thin);
  border-radius: var(--radius-md);
  padding: 0.9rem 0.85rem 0.85rem;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-system);
  font-size: 13px;
  color: var(--label);
  transition: background 0.12s, border-color 0.12s;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.tile:hover {
  background: var(--bg-tertiary);
}

.tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tile--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tile--disabled:hover {
  background: var(--bg-secondary);
}

.tile-icon {
  width: 26px;
  height: 26px;
  color: var(--label-secondary);
  flex-shrink: 0;
  margin-bottom: 0.2rem;
  transition: color 0.12s;
}

.tile:not(.tile--disabled):hover .tile-icon {
  color: var(--accent);
}

.tile-label {
  font-size: 13px;
  color: var(--label);
  font-weight: 500;
  line-height: 1.3;
  font-family: var(--font-system);
}

.tile-desc {
  font-size: 11px;
  color: var(--label-secondary);
  line-height: 1.4;
  font-family: var(--font-system);
}

.tile-soon {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--label-quaternary);
  margin-top: 0.1rem;
  font-family: var(--font-system);
}

/* ── Toast notifications ────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: max(1.5rem, calc(var(--safe-bottom) + 1rem));
  right: max(1rem, var(--safe-right));
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  max-width: min(320px, calc(100vw - 2rem));
}

.toast {
  background: var(--bg-tertiary);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius);
  padding: var(--space-10) var(--space-12);
  font-size: 13px;
  color: var(--label);
  animation: fadeIn 0.2s ease both;
  line-height: 1.4;
  box-shadow: var(--shadow-2);
  font-family: var(--font-system);
}

.toast--accent {
  border-color: rgba(10,132,255,0.4);
  color: var(--accent);
}

.toast--error {
  border-color: rgba(255,69,58,0.4);
  color: var(--tint-red);
}

.toast-actions {
  display: flex;
  gap: var(--space-8);
  margin-top: var(--space-8);
  flex-wrap: wrap;
}

.toast-action-btn {
  font-family: var(--font-system);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid rgba(10,132,255,0.4);
  border-radius: var(--radius);
  padding: 0.2rem 0.7rem;
  min-height: 28px;
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
}

.toast-action-btn:hover {
  background: rgba(10,132,255,0.12);
}

.toast-action-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Recent files strip ─────────────────────────────────────────────── */
.recents {
  background: var(--bg-grouped);
  padding: 0.75rem max(1rem, var(--safe-right)) 0 max(1rem, var(--safe-left));
}

.recents-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.recents-label {
  font-family: var(--font-system);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--label-tertiary);
  flex-shrink: 0;
}

.recent-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--label-secondary);
  background: var(--fill-quaternary);
  border: 1px solid var(--separator-thin);
  border-radius: var(--radius-pill);
  padding: var(--space-4) var(--space-10);
  min-height: 28px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-pill:hover {
  background: var(--fill-secondary);
  color: var(--label);
}

.recent-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Tile reset link ────────────────────────────────────────────────── */
.tile-reset-wrap {
  margin-top: 0.75rem;
  text-align: right;
}

.tile-reset-btn {
  font-family: var(--font-system);
  font-size: 12px;
  color: var(--label-tertiary);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 0.12s;
}

.tile-reset-btn:hover { color: var(--label-secondary); }

.tile-reset-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}

/* ── Workspace area ─────────────────────────────────────────────────── */
.workspace {
  padding: 1.5rem max(1rem, var(--safe-right)) 2rem max(1rem, var(--safe-left));
  background: var(--bg);
  flex: 1;
}

.workspace-inner {
  max-width: 900px;
  margin: 0 auto;
}

.workspace-placeholder {
  color: var(--label-tertiary);
  font-size: 14px;
  text-align: center;
  padding: 4rem 0;
  font-family: var(--font-system);
}

/* ═══════════════════════════════════════════════════════════════════════
   Tool workspace — shared styles for all mounted tools
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Tool section wrapper ────────────────────────────────────────────── */
.workspace-tool {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Tool header (back + title) ─────────────────────────────────────── */
.wt-header {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  padding-bottom: 1rem;
  border-bottom: 0.5px solid var(--separator);
}

.wt-back {
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 500;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: background 0.12s;
  padding: 0 var(--space-8);
  gap: var(--space-4);
}

.wt-back:hover {
  background: rgba(10,132,255,0.1);
  outline: none;
}

.wt-back:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wt-title {
  font-family: var(--font-system);
  font-size: 17px;
  font-weight: 600;
  color: var(--label);
  letter-spacing: -0.015em;
  margin: 0;
}

/* ── Privacy note ───────────────────────────────────────────────────── */
.wt-privacy-note {
  font-size: 13px;
  color: var(--label-secondary);
  line-height: 1.5;
  margin: 0;
  padding: var(--space-10) var(--space-12);
  background: var(--bg-secondary);
  border: 1px solid var(--separator-thin);
  border-radius: var(--radius);
  border-left: 2px solid var(--accent);
  font-family: var(--font-system);
}

/* ── Internal drop zone (inside workspace) ─────────────────────────── */
.wt-drop {
  background: var(--bg-secondary);
  border: 1px dashed var(--separator);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  outline: none;
}

.wt-drop:hover,
.wt-drop:focus-visible,
.wt-drop.wt-drop--over {
  border-color: var(--accent);
  background: rgba(10,132,255,0.05);
  box-shadow: 0 0 0 3px rgba(10,132,255,0.1);
}

.wt-drop:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wt-drop-text {
  font-size: 13px;
  color: var(--label-secondary);
  pointer-events: none;
  font-family: var(--font-system);
}

.wt-drop input[type="file"] { display: none; }

/* ── Options panel ──────────────────────────────────────────────────── */
.wt-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  padding: var(--space-12);
  background: var(--bg-secondary);
  border: 1px solid var(--separator-thin);
  border-radius: var(--radius-md);
}

.wt-option-row {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  flex-wrap: wrap;
}

/* Dimension input row */
.wt-option-row--dims { gap: 1.25rem; }

.wt-dim-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  flex: 1 1 120px;
}

.wt-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--label-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-system);
  white-space: nowrap;
  flex-shrink: 0;
}

.wt-select {
  font-family: var(--font-system);
  font-size: 16px;
  color: var(--label);
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius);
  padding: 0 var(--space-8);
  height: var(--control-h);
  min-height: 44px;
  cursor: pointer;
  outline: none;
  transition: outline 0.12s;
}

.wt-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wt-input-num {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--label);
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius);
  padding: 0 var(--space-8);
  height: var(--control-h);
  min-height: 44px;
  width: 100%;
  max-width: 160px;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.wt-input-num::-webkit-inner-spin-button,
.wt-input-num::-webkit-outer-spin-button { opacity: 0.5; }

.wt-input-num:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wt-range {
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: var(--fill-secondary);
  accent-color: var(--accent);
  cursor: pointer;
  flex: 1 1 120px;
  min-width: 80px;
  max-width: 280px;
}

.wt-range:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.wt-quality-val {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  font-family: var(--font-mono);
}

/* ── Primary + secondary buttons (PIER panel-action-btn pattern) ────── */
.wt-btn-primary {
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 0 var(--space-14);
  height: var(--control-h);
  min-height: 44px;
  cursor: pointer;
  transition: filter 0.12s;
}

.wt-btn-primary:hover { filter: brightness(0.92); }

.wt-btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wt-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
}

.wt-btn-secondary {
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0 var(--space-14);
  height: var(--control-h);
  min-height: 44px;
  cursor: pointer;
  transition: background 0.12s;
}

.wt-btn-secondary:hover {
  background: rgba(10,132,255,0.1);
}

.wt-btn-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wt-btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── File list ──────────────────────────────────────────────────────── */
.wt-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.wt-file-item {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  padding: var(--space-10) var(--space-12);
  background: var(--bg-secondary);
  border: 1px solid var(--separator-thin);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.wt-file-icon {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--label-tertiary);
  background: var(--fill-quaternary);
  border-radius: var(--radius-sm);
  padding: 2px var(--space-4);
  flex-shrink: 0;
}

.wt-file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 120px;
  min-width: 0;
}

.wt-file-name {
  font-size: 13px;
  color: var(--label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-system);
}

.wt-file-meta {
  font-size: 11px;
  color: var(--label-tertiary);
  font-family: var(--font-mono);
}

.wt-file-status {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.wt-file-size-new {
  font-size: 11px;
  color: var(--label-secondary);
  font-family: var(--font-mono);
}

.wt-btn-download {
  font-family: var(--font-system);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius);
  padding: 0 var(--space-12);
  height: var(--control-h-sm);
  min-height: 36px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: filter 0.12s;
}

.wt-btn-download:hover { filter: brightness(0.92); }

.wt-btn-download:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wt-error {
  font-size: 12px;
  color: var(--tint-red);
  font-family: var(--font-system);
}

/* ── Per-file remove button ─────────────────────────────────────────── */
.wt-file-remove {
  font-size: 14px;
  line-height: 1;
  color: var(--label-tertiary);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: var(--control-h-sm);
  height: var(--control-h-sm);
  min-width: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
  margin-left: auto;
}

.wt-file-remove:hover {
  background: rgba(255,69,58,0.12);
  color: var(--tint-red);
}

.wt-file-remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wt-file-remove:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Output size delta ──────────────────────────────────────────────── */
.wt-size-delta {
  font-family: var(--font-mono);
  font-size: 11px;
}

.wt-size-delta--down { color: var(--tint-green); }
.wt-size-delta--up   { color: var(--tint-orange); }

/* ── Batch download bar ─────────────────────────────────────────────── */
.wt-batch-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: var(--space-10) 0;
  border-top: 0.5px solid var(--separator);
}

/* ── Progress bar ───────────────────────────────────────────────────── */
.progress-bar {
  width: 100px;
  height: 3px;
  background: var(--fill-secondary);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0;
  border-radius: 2px;
  transition: width 0.2s ease;
}

/* ── Responsive workspace tools ─────────────────────────────────────── */
@media (max-width: 540px) {
  .wt-option-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .wt-option-row--dims {
    flex-direction: row;
  }

  .wt-range { max-width: 100%; }

  .wt-file-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .wt-file-status { width: 100%; }
}

/* ── Mode tabs ──────────────────────────────────────────────────────── */
.wt-mode-tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--separator);
  padding-bottom: 0;
}

.wt-mode-tab {
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 500;
  color: var(--label-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--space-8) var(--space-12);
  height: 40px;
  min-height: 44px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.wt-mode-tab:hover { color: var(--label); }

.wt-mode-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wt-mode-tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.wt-mode-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 200px;
}

/* ── Textarea ───────────────────────────────────────────────────────── */
.wt-textarea {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--label);
  background: var(--bg-secondary);
  border: 1px solid var(--separator-thin);
  border-radius: var(--radius);
  padding: var(--space-10) var(--space-12);
  width: 100%;
  resize: vertical;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.wt-textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Preview iframe ─────────────────────────────────────────────────── */
.wt-preview-pane {
  border: 1px solid var(--separator-thin);
  border-radius: var(--radius);
  overflow: hidden;
}

.wt-preview-iframe {
  width: 100%;
  min-height: 320px;
  border: none;
  background: #fff;
  display: block;
}

/* ── Archive table ──────────────────────────────────────────────────── */
.wt-archive-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: var(--font-system);
}

.wt-archive-table th {
  text-align: left;
  padding: var(--space-6) var(--space-10);
  font-size: 11px;
  font-weight: 600;
  color: var(--label-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 0.5px solid var(--separator);
  white-space: nowrap;
}

.wt-archive-table td {
  padding: var(--space-6) var(--space-10);
  border-bottom: 0.5px solid var(--separator-thin);
  vertical-align: middle;
}

.wt-archive-table tr:last-child td { border-bottom: none; }

.wt-archive-name {
  color: var(--label);
  word-break: break-all;
}

.wt-archive-size {
  font-family: var(--font-mono);
  color: var(--label-tertiary);
  white-space: nowrap;
  width: 80px;
}

/* ── Coming soon placeholder ────────────────────────────────────────── */
.wt-coming-soon {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--label-tertiary);
  font-family: var(--font-system);
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════════════
   bg-remove tool
   ═══════════════════════════════════════════════════════════════════════ */

.wt-bg-notice {
  font-size: 13px;
  color: var(--label-secondary);
  line-height: 1.5;
  margin: 0;
  padding: var(--space-10) var(--space-12);
  background: var(--bg-secondary);
  border: 1px solid var(--separator-thin);
  border-radius: var(--radius);
  border-left: 2px solid var(--separator);
  font-family: var(--font-system);
}

.wt-bg-fmt-note {
  font-size: 12px;
  color: var(--label-tertiary);
  margin: 0;
  font-style: italic;
  font-family: var(--font-system);
}

.wt-bg-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-10);
}

.wt-bg-preview-fig {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  background: var(--bg-secondary);
  border: 1px solid var(--separator-thin);
  border-radius: var(--radius-md);
  overflow: hidden;
  padding: var(--space-10);
}

.wt-bg-preview-fig--result {
  background-image:
    linear-gradient(45deg, #333 25%, transparent 25%),
    linear-gradient(-45deg, #333 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #333 75%),
    linear-gradient(-45deg, transparent 75%, #333 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  background-color: var(--bg-secondary);
}

.wt-bg-preview-img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  display: block;
  border-radius: var(--radius);
}

.wt-bg-preview-caption {
  font-size: 11px;
  font-weight: 600;
  color: var(--label-tertiary);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-system);
}

@media (max-width: 540px) {
  .wt-bg-preview { grid-template-columns: 1fr; }
  .wt-bg-preview-img { height: 140px; }
}

/* ── Mobile table stacking ──────────────────────────────────────────── */
@media (max-width: 540px) {
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; left: -9999px; }
  tr {
    background: var(--bg-secondary);
    border: 1px solid var(--separator-thin);
    border-radius: var(--radius);
    padding: var(--space-10);
    margin-bottom: var(--space-8);
  }
  td { border: 0; padding: var(--space-4) 0; display: block; }
  td::before {
    content: attr(data-label);
    display: block;
    color: var(--label-tertiary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
    font-family: var(--font-system);
  }
}

/* ── Image-convert presets ──────────────────────────────────────────── */
.wt-presets-row { align-items: flex-start; }

.wt-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  flex: 1;
}

/* Preset chip — PIER status-pill pattern */
.wt-preset-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--label-secondary);
  background: var(--fill-quaternary);
  border: 1px solid var(--separator-thin);
  border-radius: var(--radius-pill);
  padding: var(--space-4) var(--space-10);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.wt-preset-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(10,132,255,0.08);
}

.wt-preset-chip--active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(10,132,255,0.12);
}

/* ── Tool loading indicator ─────────────────────────────────────────── */
.tool-loading {
  padding: 2rem 1.5rem;
  color: var(--label-tertiary);
  font-family: var(--font-system);
  font-size: 14px;
  animation: pulse 1.2s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════════════════
   image-convert — Live size estimate + format compare + before/after
   ══════════════════════════════════════════════════════════════════════ */

.ic-size-estimate {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--label-secondary);
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 0;
}

.ic-compare-btn {
  font-family: var(--font-system);
  font-size: 12px;
  font-weight: 500;
  color: var(--label-secondary);
  background: transparent;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  padding: 0 var(--space-10);
  height: var(--control-h-sm);
  min-height: 28px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}

.ic-compare-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ic-compare-btn--active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(10,132,255,0.08);
}

.ic-compare-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ic-compare-row { padding-top: 0.1rem; }

.ic-compare-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
}

.ic-compare-line {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--label-secondary);
  padding: var(--space-6) var(--space-10);
  border-radius: var(--radius);
  background: var(--fill-quaternary);
  border: 1px solid var(--separator-thin);
}

.ic-compare-line--selected {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(10,132,255,0.08);
}

.ic-compare-line--error {
  color: var(--tint-red);
  opacity: 0.75;
}

/* Before/after preview strip */
.ic-preview-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
}

.ic-preview-fig {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--separator-thin);
  border-radius: var(--radius);
  overflow: hidden;
  padding: var(--space-8) var(--space-10);
}

.ic-preview-fig figcaption {
  font-family: var(--font-system);
  font-size: 11px;
  font-weight: 600;
  color: var(--label-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

.ic-preview-canvas {
  width: 100%;
  height: 96px;
  object-fit: contain;
  display: block;
  border-radius: var(--radius);
  object-position: center;
}

.ic-preview-unavail {
  font-family: var(--font-system);
  font-size: 12px;
  color: var(--label-tertiary);
  text-align: center;
  display: block;
  padding: 1.5rem 0;
  font-style: italic;
}

@media (max-width: 400px) {
  .ic-preview-strip { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .ic-size-estimate { order: 3; width: 100%; }
}

/* ── Footer note ────────────────────────────────────────────────────── */
.site-footer {
  padding: var(--space-12) max(1rem, var(--safe-right)) var(--space-12) max(1rem, var(--safe-left));
  background: var(--bg-grouped);
  border-top: 0.5px solid var(--separator-thin);
  text-align: center;
}

.site-footer-text {
  font-size: 12px;
  color: var(--label-tertiary);
  font-family: var(--font-system);
}
