:root {
  --h2j-surface: #ffffff;
  --h2j-surface-subtle: #f8fafc;
  --h2j-border: #e2e8f0;
  --h2j-border-strong: #cbd5e1;
  --h2j-text: #0f172a;
  --h2j-text-muted: #64748b;
  --h2j-brand: var(--tf-accent);
  --h2j-brand-hover: var(--tf-accent-hover);
  --h2j-drop-bg: var(--tf-accent-wash);
  --h2j-drop-border: var(--tf-accent-soft);
  --h2j-success: #16a34a;
  --shadow: none;
}

.h2j-main {
  box-sizing: border-box;
  max-width: 46rem;
  margin-inline: auto;
  padding: 1.5rem 1rem 3rem;
}

.h2j-wrap {
  box-sizing: border-box;
  padding-inline: 1.5rem;
  margin-inline: auto;
  max-width: 46rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.h2j-panel {
  background: var(--h2j-surface);
  border: 1px solid var(--h2j-border);
  border-radius: 2px;
  padding: 1.5rem;
  box-shadow: none;
}

.h2j-drop-zone {
  border: 2px dashed var(--h2j-drop-border);
  background: var(--h2j-drop-bg);
  border-radius: 2px;
  padding: 2.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.h2j-drop-zone:hover, .h2j-drop-zone:focus {
  border-color: var(--h2j-brand);
  background: #ffedd5;
  outline: none;
}

.h2j-drop-icon {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.h2j-drop-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--h2j-text);
  margin: 0 0 0.25rem;
}

.h2j-drop-hint {
  font-size: 0.85rem;
  color: var(--h2j-text-muted);
  margin: 0 0 1rem;
}

.h2j-drop-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  align-items: center;
}

.h2j-options-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.h2j-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.h2j-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--h2j-text);
}

.h2j-field select, .h2j-field input[type="range"] {
  border: 1px solid var(--h2j-border-strong);
  border-radius: 2px;
  padding: 0.5rem 0.75rem;
  background: var(--h2j-surface);
  color: var(--h2j-text);
  font-size: 0.9rem;
  outline: none;
}

.h2j-action-row {
  margin-top: 1.25rem;
}

.h2j-btn {
  background: var(--h2j-brand);
  color: #ffffff;
  border: none;
  border-radius: 2px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s ease;
}

.h2j-btn:hover {
  background: var(--h2j-brand-hover);
}

.h2j-secondary-btn {
  background: var(--h2j-surface);
  border: 1px solid var(--h2j-border-strong);
  border-radius: 2px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--h2j-text);
  cursor: pointer;
  transition: background 0.15s;
}

.h2j-secondary-btn:hover {
  background: var(--h2j-surface-subtle);
}

.h2j-text-btn {
  background: none;
  border: none;
  color: var(--h2j-brand);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.45rem 0.5rem;
}

.h2j-status-msg {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--h2j-text-muted);
  text-align: center;
  min-height: 1.2rem;
}

.h2j-results {
  display: block;
}

.h2j-result-card {
  background: var(--h2j-surface);
  border: 1px solid var(--h2j-border);
  border-radius: 2px;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  box-shadow: none;
}

@media (max-width: 640px) {
  .h2j-result-card {
    grid-template-columns: 1fr;
  }
}

.h2j-preview-box {
  background: var(--h2j-surface-subtle);
  border: 1px solid var(--h2j-border);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  max-height: 200px;
}

.h2j-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.h2j-result-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--h2j-text);
  margin: 0 0 0.75rem;
}

.h2j-stats-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.h2j-stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--h2j-border);
  padding-bottom: 0.35rem;
}

.h2j-stat-label {
  color: var(--h2j-text-muted);
}

.h2j-stat-value {
  color: var(--h2j-text);
  font-weight: 600;
}

.h2j-savings {
  color: var(--h2j-success);
}

.h2j-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.h2j-download-btn {
  width: auto;
  flex: 1;
}
.h2j-meta-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* tf:dark-palette — generated by migrate_chrome.py */
/* Neutrals inherit the shared chrome tokens so all tools share one
   ground; brand hues are kept and lightened, never inverted. */
[data-theme="dark"] {
  --h2j-surface: var(--tf-surface);
  --h2j-surface-subtle: var(--tf-surface);
  --h2j-border: var(--tf-surface);
  --h2j-border-strong: #98abc3;
  --h2j-text: var(--tf-ink);
  --h2j-text-muted: var(--tf-ink-faint);
  --h2j-success: #7ad89d;
}
