:root {
  --bg: #0a1408; --surface: #10240f; --surface-2: #142c12;
  --border: #1e4a1e; --border-strong: #2f7d33;
  --text: #e6fae6; --text-secondary: #a8dcae; --text-muted: #6bab7a;
  --danger: #e5484d; --success: #3fb950; --success-rgb: 63,185,80; --radius: 8px;
  --theme-transition: background 0.35s ease, color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}
/* Expert User theme — violet/magenta, applied to the whole page via
   body[data-theme="expert"] (toggled in applyUserMode()). Overrides the
   same variables everything else already reads, so no other CSS or HTML
   needs to change for the swap to take effect end-to-end. */
body[data-theme="expert"] {
  --bg: #120a1a; --surface: #1e1029; --surface-2: #251233;
  --border: #3d2154; --border-strong: #6b3f96;
  --text: #f0e6fa; --text-secondary: #c4a8e0; --text-muted: #8a6bab;
  --danger: #e5484d; --success: #c14fe0; --success-rgb: 193,79,224;
}
* { box-sizing: border-box; }
.app-header {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.25rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: var(--theme-transition);
}
.app-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0 2px, transparent 2px 8px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.03) 0 2px, transparent 2px 8px);
  pointer-events: none;
}
.app-header-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
}
.app-header-title {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  font-family: "Courier New", Courier, monospace;
}
.app-header-title-main {
  font-family: "Press Start 2P", "Courier New", Courier, monospace;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 2px;
  position: relative;
  display: inline-block;
  background: linear-gradient(90deg, #0080ff 0%, #7a5ce0 15%, #c14fe0 30%, #ff00c8 45%, #ff17b8 60%, #c14fe0 75%, #7a5ce0 90%, #0080ff 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: header-gradient-shift 1.6s linear infinite;
}
.app-header-title-main::after {
  content: "B U R N T\00a0\00a0P I X";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg,
    transparent 30%,
    rgba(255,255,255,0) 42%,
    rgba(255,255,255,0.9) 50%,
    rgba(255,255,255,0) 58%,
    transparent 70%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: header-shine 2.4s ease-in-out infinite;
  pointer-events: none;
}
.app-header-title-sub {
  font-family: "Press Start 2P", "Courier New", Courier, monospace;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 4px;
  display: inline-block;
  animation: sub-pulse 2s ease-in-out infinite;
}
@keyframes sub-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
@keyframes header-gradient-shift {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}
@keyframes header-shine {
  0% { background-position: 150% 50%; }
  100% { background-position: -150% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .app-header-title-main { animation: none; }
}
@media (max-width: 600px) {
  .app-header { padding: 1rem 1rem; }
  .app-header-title-main { font-size: 13px; letter-spacing: 1.5px; }
  .app-header-title-sub { font-size: 8px; letter-spacing: 3px; }
}
body {
  background: var(--bg); color: var(--text);
  font-family: "Courier New", Courier, monospace;
  max-width: 560px; margin: 0 auto; padding: 1.5rem;
  transition: var(--theme-transition);
}
body[data-theme="expert"] .card,
body[data-theme="expert"] input,
body[data-theme="expert"] select,
body[data-theme="expert"] button,
body[data-theme="expert"] .preview-box,
body[data-theme="expert"] .viewer-preview-loading {
  transition: var(--theme-transition);
}
h2 { margin-bottom: 0.25rem; font-weight: 500; text-align: center; }
.sub { color: var(--text-secondary); font-size: 13px; margin-top: 0; margin-bottom: 1.5rem; }
.card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 0.5rem;
}
.card.error { border-color: var(--danger); color: var(--danger); font-size: 13px; }
.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: rgba(var(--success-rgb),0.15); color: var(--success); margin-bottom: 8px;
}
label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; display: block; }
input {
  width: 100%; padding: 8px 10px; border-radius: var(--radius);
  border: 0.5px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 14px; margin-bottom: 12px;
}
button {
  padding: 8px 16px; border-radius: var(--radius);
  border: 0.5px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); cursor: pointer; font-size: 14px;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.start { background: rgba(var(--success-rgb),0.15); color: var(--success); border-color: var(--success); }
button.stop { background: rgba(229,72,77,0.15); color: var(--danger); border-color: var(--danger); }
.section-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 500; }
.section-label:empty { display: none; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; margin-bottom: 12px; }
.fee-note {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 11px; color: var(--text-muted); margin-top: 10px;
  letter-spacing: 0.3px; text-transform: uppercase;
}
.fee-note::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
}
.fee-note .fee-value {
  color: var(--text-secondary); font-weight: 600;
}

.progress-wrap { margin-top: 10px; }
.progress-track {
  position: relative;
  width: 100%; height: 22px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.02);
}
.progress-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--border-strong), var(--success));
  background-size: 200% 100%;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(var(--success-rgb),0.55), 0 0 2px rgba(var(--success-rgb),0.8);
  animation: progress-glow-pulse 2.2s ease-in-out infinite;
}
.progress-fill::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.35) 50%,
    transparent 100%
  );
  width: 60%;
  transform: translateX(-150%);
  animation: progress-shimmer 2s ease-in-out infinite;
}
@keyframes progress-glow-pulse {
  0%, 100% { filter: brightness(1); box-shadow: 0 0 10px rgba(var(--success-rgb),0.55), 0 0 2px rgba(var(--success-rgb),0.8); }
  50% { filter: brightness(1.15); box-shadow: 0 0 16px rgba(var(--success-rgb),0.8), 0 0 4px rgba(var(--success-rgb),1); }
}
@keyframes progress-shimmer {
  0% { transform: translateX(-150%); }
  100% { transform: translateX(250%); }
}
.progress-fill.infinite {
  width: 100%;
  background: repeating-linear-gradient(
    45deg,
    var(--surface-2) 0px, var(--surface-2) 10px,
    var(--border-strong) 10px, var(--border-strong) 20px
  );
  background-size: 200% 200%;
  animation: progress-stripes 1.2s linear infinite;
  opacity: 0.5;
  box-shadow: none;
}
.progress-fill.infinite::after { display: none; }
@keyframes progress-stripes {
  0% { background-position: 0 0; }
  100% { background-position: 40px 0; }
}
.refine-progress-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px; font-weight: 600;
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0,0,0,0.75), 0 0 1px rgba(0,0,0,0.9);
  letter-spacing: 0.3px;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
  padding: 0 6px;
}
.refine-progress-eta { opacity: 0.85; }
@media (max-width: 600px) {
  .refine-progress-count { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .progress-fill,
  .progress-fill::after,
  .progress-fill.infinite {
    animation: none;
  }
}
.key-box {
  margin-top: 8px; word-break: break-all; background: var(--surface-2);
  padding: 8px; border-radius: var(--radius); font-size: 11px;
}
.key-box .warn { color: var(--danger); margin-bottom: 4px; font-size: 12px; }
.key-box-header { display: flex; align-items: center; gap: 8px; }
.key-box-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.key-box-value { margin-top: 4px; }
#log {
  height: 120px; overflow-y: auto; overflow-x: hidden; font-size: 12px;
  font-family: "Courier New", Courier, monospace; margin-top: 8px;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--surface-2);
}
#log::-webkit-scrollbar { width: 8px; }
#log::-webkit-scrollbar-track {
  background: var(--surface-2); border-radius: 999px;
}
#log::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 999px;
  border: 1px solid var(--surface-2); transition: var(--theme-transition);
}
#log::-webkit-scrollbar-thumb:hover { background: var(--success); }
#log div { margin-bottom: 4px; white-space: pre-line; overflow-wrap: break-word; word-break: break-word; }
.log-info { color: var(--text-secondary); }
.log-success { color: var(--success); }
.log-error { color: var(--danger); }
.log-warning { color: #e3b341; }
.log-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: none; padding: 0;
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  font-family: inherit; cursor: pointer;
}
.log-toggle-icon {
  font-size: 18px; font-weight: 700; line-height: 1;
  transition: transform 0.2s ease; color: var(--text-muted);
}
.log-toggle-icon.open { transform: rotate(180deg); }
.getting-started-card {
  background: linear-gradient(180deg, #141414 0%, var(--surface) 100%);
  border: 1px solid rgba(var(--success-rgb),0.35);
  box-shadow: 0 0 0 1px rgba(var(--success-rgb),0.06) inset, 0 0 24px rgba(var(--success-rgb),0.06);
}
.getting-started-title-short { display: none; }
.getting-started-title {
  text-align: center; font-size: calc(1.3em - 5px); margin-bottom: 16px;
  font-family: "Press Start 2P", "Courier New", Courier, monospace;
  font-weight: 400; letter-spacing: 1px;
  color: var(--success);
  text-shadow: 0 0 6px rgba(var(--success-rgb),0.45), 0 0 18px rgba(var(--success-rgb),0.15);
}
.getting-started-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  border: 0.5px solid var(--border);
  background: var(--surface-2);
  text-decoration: none;
  margin-bottom: 10px;
  transition: var(--theme-transition), transform 0.15s ease;
}
.getting-started-row--btn {
  width: 100%; font-family: inherit; cursor: pointer;
}
/* --- "Burnt Pix in a nutshell" : carte info, pas un lien externe ---
   Distincte des lignes ci-dessous (fond ambre/doré au lieu de vert,
   bordure en tirets, badge "ABOUT", icône livre plutôt que flèche →,
   pour signaler "ceci ouvre une explication" et non "ceci vous fait
   quitter la page"). */
.getting-started-row--about {
  --about: #e3b341; --about-rgb: 227, 179, 65;
  padding: 16px; position: relative;
  justify-content: center !important;
  align-items: center;
  gap: 14px;
  width: 100% !important; max-width: 100%;
  margin-left: 0; margin-right: 0;
  margin-top: 10px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(var(--about-rgb),0.10) 0%, transparent 55%),
    var(--surface-2);
  border: 1.5px dashed rgba(var(--about-rgb),0.55);
  box-shadow: 0 0 0 1px rgba(var(--about-rgb),0.05) inset;
}
.getting-started-row--about::before {
  content: "ABOUT";
  position: absolute; top: -9px; right: 14px;
  font-size: 9px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--bg); background: var(--about);
  padding: 2px 7px; border-radius: 4px;
  line-height: 1.4;
  box-shadow: 0 0 8px rgba(var(--about-rgb),0.35);
}
.getting-started-row--about:hover {
  border-color: var(--about);
  box-shadow: 0 0 16px rgba(var(--about-rgb),0.18), 0 0 0 1px rgba(var(--about-rgb),0.08) inset;
  transform: none;
}
.getting-started-about-emoji {
  width: 40px; height: 40px; border-radius: 8px; overflow: hidden;
  background: var(--surface-2);
  border: 1px solid rgba(var(--about-rgb),0.35);
  box-shadow: 0 0 6px rgba(var(--about-rgb),0.12);
  flex-shrink: 0;
}
.getting-started-about-emoji img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.getting-started-row--about .getting-started-text {
  color: var(--about);
}
.getting-started-row--about .getting-started-link {
  color: var(--text-secondary); font-style: italic;
}
.getting-started-copy--center {
  flex: 1 1 auto !important; align-items: flex-start; text-align: left;
  min-width: 0;
}
.getting-started-row--about .getting-started-arrow {
  display: flex; align-items: center; justify-content: center;
  font-size: 0; color: var(--about); flex-shrink: 0;
  width: 22px; height: 22px;
}
.getting-started-row--about .getting-started-arrow::before {
  content: "";
  width: 18px; height: 18px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3C/svg%3E") center / contain no-repeat;
  background: currentColor;
  display: block;
}
.getting-started-row--about:hover .getting-started-arrow::before {
  background: var(--about);
}

/* Texte court/long responsive pour la ligne "About" */
.about-text-short, .about-link-short { display: none; }

/* Desktop : image + titre centrés dans leur row */
@media (min-width: 601px) {
  .getting-started-row--about {
    justify-content: center !important;
  }
  .getting-started-copy--center {
    flex: 0 0 auto !important; align-items: center; text-align: center;
  }
}

@media (max-width: 600px) {
  .about-text-full, .about-link-full { display: none; }
  .about-text-short, .about-link-short { display: inline; }
}
.getting-started-row:last-child { margin-bottom: 0; }
.getting-started-row:hover {
  border-color: var(--border-strong);
  box-shadow: 0 0 12px rgba(var(--success-rgb),0.12);
  transform: translateY(-1px);
}
.getting-started-emoji {
  font-size: 22px; flex-shrink: 0; line-height: 1;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
}
.getting-started-emoji--x { color: var(--text); }
.getting-started-emoji--x svg { width: 18px; height: 18px; display: block; }
.getting-started-row:hover .getting-started-emoji--x { color: var(--success); }
.getting-started-emoji--img {
  border-radius: 6px; overflow: hidden;
  background: var(--surface-2);
}
.getting-started-emoji--img img {
  width: 100%; height: 100%; object-fit: cover;
  display: block; border-radius: 6px;
  mix-blend-mode: lighten;
}
.getting-started-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.getting-started-text { font-size: 13px; color: var(--text); font-weight: 500; }
.getting-started-link {
  font-size: 12px; color: var(--success);
  word-break: break-word;
}
.getting-started-arrow {
  font-size: 16px; color: var(--text-muted); flex-shrink: 0;
  transition: var(--theme-transition), transform 0.15s ease;
}
.getting-started-row:hover .getting-started-arrow {
  color: var(--success); transform: translateX(2px);
}
code { font-size: 11px; }
.small-btn {
  padding: 3px 10px; font-size: 12px; border-radius: 4px;
  border: 0.5px solid var(--text-secondary); background: transparent;
  color: inherit; cursor: pointer; font-family: inherit;
}
.small-btn:hover { opacity: 0.8; }
.iterations-input-row { display: flex; gap: 6px; align-items: stretch; }
.iterations-input-row input { flex: 1; min-width: 0; }
.iterations-input-row .small-btn { flex-shrink: 0; padding: 6px 10px; }
.iterations-input-row .small-btn:disabled { opacity: 0.5; cursor: default; }
.gas-feedback { display: flex; align-items: center; gap: 6px; }
.gas-feedback.gas-ok { color: var(--success); }
.gas-feedback.gas-warn { color: #e3b341; }
.gas-feedback.gas-over { color: var(--danger); }
#btn-fund-wallet { color: var(--text); border-color: var(--text); }
.privkey-hidden { user-select: none; letter-spacing: 2px; }
.step-done { color: var(--success); font-size: 14px; }
.settings-row { display: flex; gap: 12px; }
.settings-row > div { flex: 1; min-width: 0; }
.settings-row label { text-align: center; }
.settings-row input {
  width: 100%; padding: 6px 8px; font-size: 12px; margin-bottom: 0;
  text-align: center;
}
.settings-row input[type="number"] {
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.settings-row input[type="number"]::-webkit-outer-spin-button,
.settings-row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
.settings-row input:disabled {
  color: var(--text-muted);
  background: var(--surface-2);
  border-color: var(--border);
  opacity: 0.6;
  cursor: not-allowed;
}
.balance-row { margin-top: 8px; }
.balance-row-lg { font-size: 14px; }
.balance-row-flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.balance-row-flex > .push-right { margin-left: auto; }
.fund-amount-input {
  width: 45px; flex: 0 0 45px; padding: 6px 8px; font-size: 12px; margin-bottom: 0;
}
@media (min-width: 601px) {
  .fund-amount-input {
    width: 50px;
    flex: 0 0 50px;
  }
}
.no-spinner {
  -moz-appearance: textfield;
  appearance: textfield;
}
.no-spinner::-webkit-outer-spin-button,
.no-spinner::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
.step3-desc { font-size: 13px; color: var(--text-secondary); margin-top: 0; }
.tx-count-row { margin-top: 8px; font-size: 13px; color: var(--text-secondary); }
.start-row { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }
/* Expert Settings: nudge the Start/Stop row down a touch so it isn't
   flush against the inputs above, but only while the Burnt Pix preview
   box is empty/hidden — toggled via .start-row-nudge by JS, since the
   preview box sits between the settings and this row in the DOM. */
#step5-expert .start-row.start-row-nudge {
  margin-top: 10px;
}

.mode-tabs {
  display: flex; gap: 8px; margin-bottom: 0.75rem;
}
.mode-tab {
  flex: 1; padding: 8px 10px; border-radius: var(--radius);
  /* Inactive tabs stay neutral regardless of the active theme (Expert's
     violet only applies to the rest of the page, and to this tab once
     it's the active one — see .mode-tab.active below). Hardcoded here
     on purpose, not var(--border-strong)/var(--text-secondary), which
     the Expert theme overrides. */
  border: 0.5px solid #555; background: #212121;
  color: #aaa; cursor: pointer; font-size: 13px;
  font-family: "Press Start 2P", "Courier New", Courier, monospace;
  text-align: center;
}
.mode-tab.active {
  background: rgba(var(--success-rgb),0.12); color: var(--success); border-color: var(--success);
}
.expert-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; margin-bottom: 12px; }
.progress-bar {
  display: flex; align-items: flex-start; margin-bottom: 1rem; padding: 0 28px 16px;
}
.progress-step {
  display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.progress-dot {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  -webkit-user-select: none; user-select: none;
  line-height: 1;
  opacity: 0.4; filter: grayscale(65%);
  transition: var(--theme-transition), opacity 0.35s ease, filter 0.35s ease, transform 0.25s ease, box-shadow 0.35s ease;
}
.progress-label {
  font-size: 10px; color: var(--text-muted); white-space: nowrap;
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  margin-top: 4px; opacity: 0.55; letter-spacing: 0.2px;
  transition: var(--theme-transition), opacity 0.35s ease;
}
.progress-line {
  flex: 1; height: 2px; background: var(--border); margin-top: 13px; min-width: 8px;
  opacity: 0.5;
  transition: var(--theme-transition), opacity 0.35s ease, background 0.35s ease;
}

/* Reached / completed step: bright, filled, unmistakably "done". */
.progress-step.done .progress-dot {
  background: var(--success);
  color: #ffffff;
  border-color: var(--success);
  opacity: 1; filter: none;
  box-shadow: 0 0 0 3px rgba(var(--success-rgb),0.18), 0 0 10px rgba(var(--success-rgb),0.35);
}
.progress-step.done .progress-label {
  color: var(--success); opacity: 1; font-weight: 600;
}

/* Once step 5 is reached, steps 1-3 double as "recap" toggles: clicking
   them shows/hides their native status block (UP connected, Local Wallet
   info, Permissions configured) again. Cursor affordance only. */
.progress-step.clickable-recap {
  cursor: pointer;
}
.progress-step.clickable-recap .progress-dot:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 3px rgba(var(--success-rgb),0.28), 0 0 12px rgba(var(--success-rgb),0.45);
}

/* Current step: clearly highlighted but visually distinct from "done".
   The scale animation runs on the step wrapper so the dot, emoji and
   label all zoom in/out together; dot-only effects (glow, fill color)
   stay scoped to .progress-dot so the label text isn't affected by them. */
.progress-step.active {
  animation: progress-step-zoom 1s ease-in-out infinite;
  transform-origin: center top;
}
.progress-step.active .progress-dot {
  transition: none;
  opacity: 1; filter: none;
  animation: progress-dot-glow 1s ease-in-out infinite;
}
.progress-step.active .progress-label {
  opacity: 1; font-weight: 600;
  animation: progress-label-glow 1s ease-in-out infinite;
}
@keyframes progress-label-glow {
  0%, 100% { color: #000000; }
  50% { color: var(--success); }
}
@keyframes progress-step-zoom {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}
@keyframes progress-dot-glow {
  0%, 100% {
    background: #000000;
    border-color: #46ff40;
    box-shadow: none;
    color: #a3ffa0;
  }
  50% {
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 0 0 6px rgba(var(--success-rgb),0.4), 0 0 18px rgba(var(--success-rgb),0.75);
    color: #a3ffa0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .progress-step.active { animation: none; transform: scale(1.15); }
  .progress-step.active .progress-dot {
    animation: progress-dot-glow 1.4s ease-in-out infinite;
  }
  .progress-step.active .progress-label {
    animation: progress-label-glow 1.4s ease-in-out infinite;
  }
}

.progress-line.done { background: var(--success); opacity: 1; }
.settings-row-3 { display: flex; gap: 12px; flex-wrap: wrap; }
.settings-row-3 > div { flex: 1; min-width: 90px; }
.settings-row-3 label { text-align: center; }
.settings-row-3 input { text-align: center; }
.settings-group-label {
  font-size: 12px; color: var(--text-secondary); margin-top: 14px; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.5px; border-top: 0.5px solid var(--border);
  padding-top: 10px;
  font-weight: 700; color: #f5f5f5;
}
.settings-group-label:first-of-type { border-top: none; padding-top: 0; margin-top: 4px; }
.settings-group-label-center { text-align: center; }

.settings-group-heading {
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.info-tooltip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--text-secondary); color: var(--text-secondary);
  font-size: 10px; font-style: normal; line-height: 1; cursor: help;
  text-transform: none; letter-spacing: normal;
}
.info-tooltip .info-tooltip-bubble {
  visibility: hidden; opacity: 0; position: absolute;
  bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: 240px; max-width: 70vw;
  background: var(--surface-2); border: 0.5px solid var(--border-strong);
  border-radius: var(--radius); padding: 8px 10px;
  font-size: 11px; line-height: 1.5; color: var(--text); text-align: left;
  text-transform: none; letter-spacing: normal; font-weight: 400;
  white-space: normal; z-index: 20;
  transition: opacity 0.12s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.info-tooltip .info-tooltip-bubble::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--border-strong);
}
.info-tooltip:hover .info-tooltip-bubble,
.info-tooltip:focus .info-tooltip-bubble {
  visibility: visible; opacity: 1;
}
@media (max-width: 600px) {
  .info-tooltip .info-tooltip-bubble { width: 200px; }
  .getting-started-title-full { display: none; }
  .getting-started-title-short { display: inline; }
}

#viewer-card {
  background: linear-gradient(180deg, #141414 0%, var(--surface) 100%);
  border: 1px solid rgba(var(--success-rgb),0.35);
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(var(--success-rgb),0.06) inset, 0 0 24px rgba(var(--success-rgb),0.06),
    0 8px 24px rgba(0,0,0,0.35);
  position: relative;
  overflow: hidden;
}
#viewer-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--success), transparent);
  opacity: 0.7;
}
#viewer-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(
    0deg, rgba(255,255,255,0.012) 0px, rgba(255,255,255,0.012) 1px,
    transparent 1px, transparent 3px
  );
  mix-blend-mode: overlay;
}

.viewer-title {
  text-align: center; font-size: calc(1.4em - 5px); margin-bottom: 12px;
  font-family: "Press Start 2P", "Courier New", Courier, monospace;
  font-weight: 400; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--success);
  text-shadow: 0 0 6px rgba(var(--success-rgb),0.45), 0 0 18px rgba(var(--success-rgb),0.15);
  position: relative;
}
.viewer-title::before {
  content: ">\00a0"; color: var(--text-muted); text-shadow: none;
}
.viewer-title::after {
  content: "_"; color: var(--success); margin-left: 2px;
  animation: viewer-title-blink 1s step-end infinite;
}
@keyframes viewer-title-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

#viewer-input-tokenid {
  font-family: "Courier New", Courier, monospace;
  background: #0c0c0c;
  border: 1px solid var(--border);
  color: var(--success);
  text-align: center;
  letter-spacing: 1px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#viewer-input-tokenid::placeholder { color: var(--text-muted); letter-spacing: normal; }
#viewer-input-tokenid:focus {
  outline: none;
  border-color: var(--success);
  box-shadow: 0 0 0 2px rgba(var(--success-rgb),0.15);
}

#viewer-preview-box {
  background: #0c0c0c;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
#viewer-preview-img {
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 0 14px rgba(var(--success-rgb),0.12);
  opacity: 1;
  transition: opacity 0.15s ease;
}
/* Applied while a new tokenId's preview is loading but the previous
   image is still on screen — dims it instead of a blank/flashed swap. */
.viewer-preview-img-loading {
  opacity: 0.35;
}
.viewer-preview-loading {
  margin-top: 12px; margin-bottom: 16px;
  display: flex; justify-content: center; align-items: center;
  width: 256px; height: 256px; max-width: 100%;
  margin-left: auto; margin-right: auto;
  background: #0c0c0c;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.viewer-preview-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(var(--success-rgb),0.2);
  border-top-color: var(--success);
  border-radius: 50%;
  animation: viewer-spin 0.8s linear infinite;
}
@keyframes viewer-spin {
  to { transform: rotate(360deg); }
}
#viewer-preview-attrs {
  background: transparent;
  border: none;
  justify-content: space-between;
  align-self: stretch;
}
#viewer-preview-attrs .preview-attr-label {
  font-family: "Courier New", Courier, monospace;
  color: var(--text-muted);
}
#viewer-preview-attrs .preview-attr-value {
  font-family: "Courier New", Courier, monospace;
  color: var(--success);
  text-shadow: 0 0 6px rgba(var(--success-rgb),0.25);
}

#viewer-owner-row {
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  color: var(--text-secondary);
}
#viewer-attr-owner {
  font-weight: 700;
  text-shadow: 0 0 6px rgba(var(--success-rgb),0.25);
}
#btn-viewer-refresh {
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--success);
  background: linear-gradient(180deg, rgba(var(--success-rgb),0.14) 0%, rgba(var(--success-rgb),0.05) 100%);
  border: 1px solid rgba(var(--success-rgb),0.35);
  border-radius: 999px;
  padding: 7px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease, color 0.18s ease;
  cursor: pointer;
}
#btn-viewer-refresh:hover {
  background: linear-gradient(180deg, rgba(var(--success-rgb),0.22) 0%, rgba(var(--success-rgb),0.08) 100%);
  border-color: rgba(var(--success-rgb),0.6);
  box-shadow: 0 2px 8px rgba(var(--success-rgb),0.18), inset 0 1px 0 rgba(255,255,255,0.06);
}
#btn-viewer-refresh:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3), inset 0 1px 2px rgba(0,0,0,0.25);
}
#btn-viewer-refresh:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
#btn-viewer-refresh:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--success-rgb),0.3), 0 2px 8px rgba(var(--success-rgb),0.18);
}

.preview-box {
  margin-top: 12px; margin-bottom: 16px;
  display: flex; justify-content: center; align-items: center; gap: 16px;
  flex-wrap: wrap;
}
.preview-img {
  max-width: 100%; width: 128px; height: 128px;
  image-rendering: pixelated;
  object-fit: contain;
  display: block;
}
.viewer-preview-img {
  width: 100%;
  max-width: 256px;
  height: auto;
  aspect-ratio: 1 / 1;
  min-width: 0;
  flex-shrink: 1;
}
.preview-attrs {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface-2); border: 0.5px solid var(--border);
  border-radius: var(--radius); padding: 8px 14px;
}
@media (max-width: 600px) {
  /* REFINE tab preview card only — scaled down 10%, image and gap
     shrink together so the gif placeholder stays visually harmonized
     with the attrs box at every screen size. */
  #preview-box { gap: 14.4px; }
  #preview-box .preview-img { width: 115.2px !important; height: 115.2px !important; }
  #preview-box .preview-attrs { padding: 7.2px 12.6px; gap: 7.2px; }
}
#viewer-stats-rows {
  display: flex; flex-direction: column; gap: 8px;
}
.preview-attr {
  text-align: center;
}
.preview-attr-label {
  font-size: 11px; color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 0.5px; text-align: center;
}
.preview-attr-value {
  font-size: 14px; color: var(--text); font-weight: 500; margin-top: 2px;
  text-align: center;
}
.preview-attr-detail {
  font-size: 10px; color: #ffffff; opacity: 0.6;
  font-weight: 300; margin-top: 2px; text-align: center; line-height: 1.4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
#viewer-preview-attrs .preview-attr-detail {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: #ffffff;
  text-shadow: none;
  font-weight: 300;
}

.password-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1.5rem;
}
.password-modal-box {
  background: var(--surface); border: 0.5px solid var(--border-strong);
  border-radius: 12px; padding: 1.25rem; max-width: 420px; width: 100%;
  font-family: "Courier New", Courier, monospace;
}
.password-modal-message {
  font-size: 13px; color: var(--text); line-height: 1.5; margin-bottom: 12px;
  white-space: pre-line;
}
.password-modal-input {
  width: 100%; padding: 8px 10px; border-radius: var(--radius);
  border: 0.5px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 14px; font-family: inherit; margin-bottom: 8px;
}
.password-modal-error {
  color: var(--danger); font-size: 12px; margin-bottom: 8px;
}
.password-modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
}
.about-bpix-modal-box {
  max-width: 540px;
  max-height: 80vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #141414 0%, var(--surface) 100%);
  border: 1px solid rgba(var(--success-rgb),0.35);
  box-shadow: 0 0 0 1px rgba(var(--success-rgb),0.06) inset, 0 0 32px rgba(var(--success-rgb),0.1);
  position: relative;
  padding-top: 1.5rem;
}
.about-bpix-modal-box::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--success), transparent);
  opacity: 0.6;
}
/* Custom themed scrollbar */
.about-bpix-modal-box {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--success-rgb),0.5) transparent;
}
.about-bpix-modal-box::-webkit-scrollbar {
  width: 8px;
}
.about-bpix-modal-box::-webkit-scrollbar-track {
  background: var(--surface-2);
  border-radius: 8px;
}
.about-bpix-modal-box::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(var(--success-rgb),0.7), rgba(var(--success-rgb),0.35));
  border-radius: 8px;
  box-shadow: 0 0 6px rgba(var(--success-rgb),0.3);
}
.about-bpix-modal-box::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--success-rgb),0.85);
}
.about-bpix-title {
  text-align: center; font-size: 1.3em; margin-bottom: 14px;
  font-weight: 700; letter-spacing: 1px;
  color: var(--success);
  text-shadow: 0 0 6px rgba(var(--success-rgb),0.45), 0 0 18px rgba(var(--success-rgb),0.15);
}
.about-bpix-title-full, .about-bpix-title-short {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.about-bpix-title-icon {
  width: 1.3em; height: 1.3em; border-radius: 4px; object-fit: cover;
  vertical-align: middle; flex-shrink: 0;
}
.about-bpix-title-short { display: none; }
@media (max-width: 600px) {
  .about-bpix-title-full { display: none; }
  .about-bpix-title-short { display: inline-flex; }
}
.about-bpix-message {
  font-size: 14px; color: var(--text); line-height: 1.6; margin-bottom: 14px;
}
.about-bpix-message p { margin: 0 0 10px 0; }
.about-bpix-message p:last-child { margin-bottom: 0; }
.about-bpix-heading {
  color: var(--success); font-weight: 700; letter-spacing: 0.5px;
  margin-top: 14px !important;
  display: flex; align-items: center; gap: 8px;
}
.about-bpix-heading::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 6px rgba(var(--success-rgb),0.7);
  flex-shrink: 0;
}
.about-bpix-closing {
  color: var(--text-secondary); font-style: italic;
  border-top: 0.5px solid var(--border); padding-top: 12px; margin-top: 14px !important;
}
.about-bpix-message code {
  color: var(--success); background: var(--surface-2);
  border: 0.5px solid rgba(var(--success-rgb),0.25);
  padding: 1px 5px; border-radius: 4px;
}
.error-modal-box {
  border-color: var(--danger);
}
.error-modal-title {
  display: block; text-align: center; font-size: 1.4em; margin-bottom: 12px;
  color: var(--danger);
}
.error-modal-message {
  font-size: 13px; color: var(--text); line-height: 1.5; margin-bottom: 16px;
  text-align: center; white-space: pre-line;
}
.error-modal-actions {
  display: flex; justify-content: center;
}
.error-modal-actions button {
  border-color: var(--danger); color: var(--danger);
  background: rgba(229,72,77,0.15);
}
#viewer-attr-owner { color: var(--success); text-decoration: none; }
#viewer-attr-owner:hover { text-decoration: underline; }
.viewer-refresh-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; min-width: 84px;
}
.viewer-refresh-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px;
  line-height: 0;
  transform-origin: 50% 50%;
  transition: none;
}
.viewer-refresh-icon svg {
  display: block;
  width: 100%; height: 100%;
}
.viewer-refresh-icon.spinning {
  animation: viewer-refresh-spin 1s linear infinite;
}
@keyframes viewer-refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
  #eoa-address { font-size: calc(1em - 0.5px); }
  .section3-label-full { display: none; }
  #step4-check { display: none; }
  .send-back-label-full { display: none; }
  .numtxs-label-full { display: none; }
  .section2-label-full { display: none; }
  .privkey-label-full { display: none; }
  .gascap-label-full { display: none; }
  .fail-fallback-label-full { display: none; }
  .itertx-label-full { display: none; }
  .finaliters-label-full { display: none; }
}
@media (min-width: 601px) {
  .section3-label-short { display: none; }
  .send-back-label-short { display: none; }
  .numtxs-label-short { display: none; }
  .section2-label-resp { display: none; }
  .privkey-label-resp { display: none; }
  .gascap-label-resp { display: none; }
  .fail-fallback-label-short { display: none; }
  .itertx-label-short { display: none; }
  .finaliters-label-short { display: none; }
}
/* Burnt Pix Viewer — TokenID dropdown (list of tokens owned by the
   connected UP), shown on focusing the tokenID input. */
.viewer-tokenid-dropdown {
  position: fixed;
  z-index: 1000;
  background: #0c0c0c;
  border: 1px solid rgba(var(--success-rgb),0.35);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  max-height: 220px; /* ~5 rows */
  overflow-y: auto;
  overflow-x: hidden;
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--success-rgb),0.55) rgba(255,255,255,0.04);
}
/* WebKit (Chrome, Safari, Edge, mobile browsers) */
.viewer-tokenid-dropdown::-webkit-scrollbar {
  width: 8px;
}
.viewer-tokenid-dropdown::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
}
.viewer-tokenid-dropdown::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(var(--success-rgb),0.75) 0%, rgba(var(--success-rgb),0.45) 100%);
  border-radius: 8px;
  border: 1px solid rgba(var(--success-rgb),0.15);
  box-shadow: 0 0 6px rgba(var(--success-rgb),0.35);
}
.viewer-tokenid-dropdown::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(var(--success-rgb),0.95) 0%, rgba(var(--success-rgb),0.6) 100%);
  box-shadow: 0 0 10px rgba(var(--success-rgb),0.5);
}
.viewer-tokenid-dropdown::-webkit-scrollbar-thumb:active {
  background: var(--success);
}
.viewer-tokenid-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 0.5px solid var(--border);
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  color: var(--text);
}
.viewer-tokenid-option:last-child { border-bottom: none; }
.viewer-tokenid-option:hover,
.viewer-tokenid-option.highlighted {
  background: rgba(var(--success-rgb),0.1);
}
.viewer-tokenid-option-thumb {
  width: 28px; height: 28px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 0.5px solid var(--border-strong);
  image-rendering: pixelated;
  background: var(--surface-2);
  object-fit: cover;
}
.viewer-tokenid-option-thumb-placeholder {
  width: 28px; height: 28px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 0.5px solid var(--border);
  background: var(--surface-2);
}
.viewer-tokenid-option-id {
  color: var(--success);
  letter-spacing: 0.5px;
}
.viewer-tokenid-dropdown-status {
  padding: 10px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  font-family: "Courier New", Courier, monospace;
}
/* Responsive: shave 1px off every text size across all tabs/pages.
   Base body font-size drives h2/headings and any element without an
   explicit font-size (they inherit); every element that DOES set an
   explicit px font-size is listed individually so it's reduced too,
   since explicit px values don't scale with the body's em/rem. */
@media (max-width: 600px) {
  body { font-size: calc(1em - 2px); }

  .sub,
  .card.error,
  label,
  .section-label,
  .eoa-info,
  .step3-desc,
  .tx-count-row,
  .mode-tab,
  .password-modal-message { font-size: calc(13px - 2px); }

  input,
  button,
  .step-done,
  .balance-row-lg,
  .preview-attr-value,
  .password-modal-input { font-size: calc(14px - 2px); }

  .badge,
  .key-box .warn,
  #log,
  .small-btn,
  .settings-row input,
  .fund-amount-input,
  .expert-hint,
  .settings-group-label,
  .preview-attr-label,
  .password-modal-error,
  #viewer-owner-row,
  #btn-viewer-refresh,
  .viewer-tokenid-option,
  .viewer-tokenid-dropdown-status { font-size: calc(12px - 2px); }

  .progress-label { font-size: calc(10px - 2px); }

  .key-box,
  code,
  .info-tooltip .info-tooltip-bubble { font-size: calc(11px - 2px); }

  .info-tooltip { font-size: calc(10px - 2px); }

  .viewer-title { font-size: calc(1.4em - 5px - 4px + 2px); }

  .getting-started-title-short { font-size: calc(1.3em - 5px + 4px - 2px); }

  #eoa-address { font-size: calc(1em - 2.5px); }

  .iterations-input-row { flex-direction: column; gap: 6px; }
  .iterations-input-row .small-btn { width: 100%; padding: 8px 10px; }
}