:root {
  --bg: #0a0a0f;
  --surface: #16141f;
  --surface-2: #1e1b2b;
  --text: #f0f0f5;
  --muted: #9d9bab;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #8b5cf6;
  --accent-ink: #ffffff;
  --accent-hover: #7c3aed;
  --success: #34d399;
  --error: #f43f5e;
  --radius: 16px;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 32px rgba(0, 0, 0, 0.5);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: transparent;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Ambient moving background is rendered by vendor/aurora-bg.js (canvas, inserted as body's first child) */

h1, h2, h3 {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  max-width: 1520px;
}

/* Liquid glass — translucent surface with a soft gradient edge highlight */
.liquid-glass {
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: none;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.liquid-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.1) 20%,
    rgba(255, 255, 255, 0) 40%,
    rgba(255, 255, 255, 0) 60%,
    rgba(255, 255, 255, 0.1) 80%,
    rgba(255, 255, 255, 0.35) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 15, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-ink);
}

.nav-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
}

.nav-back {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.nav-back:hover {
  color: var(--text);
}

/* Hero */
.hero {
  text-align: center;
  padding: 64px 0 40px;
}

.hero h1 {
  margin: 0 0 18px;
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: clamp(2.6rem, 6.4vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  animation: heroIn 0.6s var(--ease) both;
}

.hero h1 .gradient-text {
  font-style: italic;
}

.hero .subtitle {
  animation: heroIn 0.6s var(--ease) both 0.08s;
}

.hero .badges {
  animation: heroIn 0.6s var(--ease) both 0.16s;
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.gradient-text {
  color: var(--accent);
}

.subtitle {
  margin: 0 auto 24px;
  max-width: 520px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 1.02rem;
}

.badges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.08);
}

main {
  padding: 8px 0 72px;
}

.card {
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  animation: heroIn 0.5s var(--ease) both 0.1s;
}

.notice, .dropzone {
  animation: heroIn 0.5s var(--ease) both 0.05s;
}

/* Filter tabs + search (homepage) */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab {
  background: none;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  background: var(--text);
  color: var(--bg);
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 280px;
}

.search-input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
}

#searchInput:focus {
  outline: none;
  border-color: var(--accent);
}

/* Tools grid (homepage) */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 16px;
}

@media (max-width: 1480px) {
  .tools-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 1180px) {
  .tools-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 860px) {
  .tools-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .tools-grid { grid-template-columns: 1fr; }
}

.tool-card {
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: var(--text);
  display: block;
  position: relative;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.2s var(--ease);
  animation: cardIn 0.5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 0.04s);
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(139, 92, 246, 0.22);
  border-color: rgba(139, 92, 246, 0.4);
}

.tool-card:active {
  transform: translateY(-1px) scale(0.99);
  transition-duration: 0.1s;
}

/* Cursor-tracking spotlight — follows the mouse inside cards and the dropzone */
.tool-card, .card, .dropzone {
  position: relative;
}

.tool-card::before, .card::before, .dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle 260px at var(--mx, 50%) var(--my, 50%), rgba(139, 92, 246, 0.2), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
  z-index: 0;
}

.tool-card:hover::before, .card:hover::before, .dropzone:hover::before {
  opacity: 1;
}

.tool-card > *, .card > *, .dropzone > * {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .tool-card::before, .card::before, .dropzone::before { display: none; }
}

.tool-card.is-disabled {
  opacity: 0.55;
  cursor: default;
}

@keyframes cardIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tool-icon {
  display: flex;
  align-items: flex-start;
  margin-bottom: 14px;
  transition: transform 0.35s var(--ease);
}

.tool-icon svg {
  width: 27px;
  height: 32px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

.tool-card:hover .tool-icon {
  transform: scale(1.08);
}

.tool-card h3 {
  margin: 0 0 6px;
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.35;
  letter-spacing: normal;
}

.tool-card p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.5;
}

.soon-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

.empty-state.hidden { display: none; }

/* Controls */
.controls {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 200px;
}

.control-row label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.value-pill {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  outline: none;
  border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
}

select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.text-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.dropzone {
  cursor: pointer;
  text-align: center;
  padding: 52px 20px;
  border: 1.5px dashed var(--border);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}

.dropzone:hover {
  border-color: var(--accent);
}

.dropzone:hover .dropzone-icon-circle {
  transform: translateY(-3px);
}

.dropzone-icon-circle {
  transition: transform 0.3s var(--ease);
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.06);
}

.dropzone-icon-circle {
  width: 48px;
  height: 48px;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  color: var(--accent);
}

.dropzone-icon-circle svg {
  width: 20px;
  height: 20px;
}

.dropzone-title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 6px;
}

.dropzone-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.results-section {
  margin-top: 32px;
}

.results-section.hidden { display: none; }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.results-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 20px;
  padding: 10px 20px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
}

.btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn:disabled:active {
  transform: none;
}

.btn:focus-visible,
.tab:focus-visible,
.mode-tab:focus-visible,
.tool-card:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  animation: fileRowIn 0.35s var(--ease) both;
}

@keyframes fileRowIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fillPop {
  0% { transform: scaleY(1); }
  40% { transform: scaleY(1.8); }
  100% { transform: scaleY(1); }
}

.file-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.file-thumb-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-thumb-icon svg {
  width: 18px;
  height: 18px;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-sizes {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 3px;
}

.saved-badge {
  color: var(--success);
  font-weight: 700;
  margin-left: 6px;
}

.progress-track {
  margin-top: 9px;
  height: 4px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 40%;
  border-radius: 4px;
  animation: indeterminate 1.1s ease-in-out infinite;
}

.progress-fill.done {
  width: 100%;
  background: var(--success);
  transform-origin: center;
  animation: fillPop 0.4s var(--ease);
}

.progress-fill.error {
  width: 100%;
  background: var(--error);
  animation: none;
}

@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

.download-link {
  flex-shrink: 0;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
  animation: downloadPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.download-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(139, 92, 246, 0.08);
  transform: translateY(-2px);
}

.download-link:active {
  transform: translateY(0) scale(0.92);
}

@keyframes downloadPop {
  0% { opacity: 0; transform: scale(0.4) rotate(-25deg); }
  60% { opacity: 1; transform: scale(1.15) rotate(4deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  .download-link { animation: none; }
}

.remove-btn {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-btn:hover {
  border-color: var(--error);
  color: var(--error);
}

.file-order-badge {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.reorder-btns {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.reorder-btn {
  width: 26px;
  height: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  line-height: 1;
}

.reorder-btn:hover { border-color: var(--accent); }
.reorder-btn:disabled { opacity: 0.3; cursor: default; }

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid rgba(139, 92, 246, 0.28);
  border-radius: var(--radius);
  background: rgba(139, 92, 246, 0.08);
  color: #c4b5fd;
  font-size: 0.85rem;
  line-height: 1.6;
}

.notice svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--accent);
}

.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.mode-tab {
  flex: 1;
  min-width: 90px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.mode-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(139, 92, 246, 0.1);
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.range-row input[type="number"],
.range-row input[type="text"] {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.range-row input[type="number"] { width: 90px; }

.range-sep {
  color: var(--muted);
  font-size: 0.85rem;
}

.page-count {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 8px;
}

.signature-pad-wrap {
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: #ffffff;
  touch-action: none;
}

.ad-slot {
  min-height: 0;
}

/* Builder forms (facturas, CV, firma de correo) */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

.form-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 28px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.form-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

textarea.text-input {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  line-height: 1.5;
}

.repeater-entry {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.remove-entry {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  line-height: 1;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.remove-entry:hover {
  color: var(--error);
  border-color: var(--error);
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 70px 100px 32px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

@media (max-width: 640px) {
  .item-row { grid-template-columns: 1fr 1fr; }
  .item-row > *:first-child { grid-column: 1 / -1; }
  .item-row > *:last-child { grid-column: 1 / -1; justify-self: end; }
}

.btn-add-row {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.btn-add-row:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.totals-row {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.totals-row .totals-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.totals-row .totals-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.signature-preview {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  background: #ffffff;
  color: #1a1a1a;
  overflow-x: auto;
}

.site-footer {
  text-align: center;
  padding: 32px 0 56px;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-links {
  margin-top: 10px !important;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.footer-links a:hover {
  color: var(--accent);
}

@media (max-width: 480px) {
  .hero { padding: 48px 0 32px; }
  .file-row { flex-wrap: wrap; }
}

/* Text refinement */
h1, h2, .hero .subtitle {
  text-wrap: balance;
}

.file-sizes, .stat-value, .nav-tag, #statsLabel {
  font-variant-numeric: tabular-nums;
}

/* Skip-to-content link (keyboard accessibility) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 18px;
  border-radius: 0 0 8px 0;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 100;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

html {
  scroll-behavior: smooth;
}

/* Inline message banner — replaces window.alert() for form/tool errors */
.inline-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 16px;
  animation: messageIn 0.2s ease-out;
}

.inline-message.error {
  background: rgba(195, 50, 74, 0.1);
  color: #e08a99;
  border: 1px solid rgba(195, 50, 74, 0.35);
}

.inline-message.info {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.inline-message svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Completion mascot — little violet character that pops up with a thumbs-up */
.pixshrink-mascot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 18px 8px 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(16px) scale(0.9);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  pointer-events: none;
}

.pixshrink-mascot.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: mascotBounce 0.6s var(--ease) 0.3s;
}

.pixshrink-mascot.hide {
  opacity: 0;
  transform: translateY(10px) scale(0.92);
}

.pixshrink-mascot-text {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
}

@keyframes mascotBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-6px) scale(1.05); }
}

.pixshrink-mascot-arm {
  transform-origin: 46px 33px;
  animation: mascotWave 0.5s ease-in-out 0.5s 2;
}

@keyframes mascotWave {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-18deg); }
}

@media (prefers-reduced-motion: reduce) {
  .pixshrink-mascot { transition: opacity 0.2s; animation: none !important; }
  .pixshrink-mascot-arm { animation: none !important; }
}

/* Reduced motion: collapse all decorative animation to instant */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
