html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin-bottom: 60px;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(95, 208, 104, 0.35);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--text-muted);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Topbar */

.topbar {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.topbar__inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar__brand {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.topbar__prompt {
  color: var(--accent);
}

.topbar__menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
}

.topbar__menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--text);
}

/* Bootstrap's .collapse:not(.show) rule (specificity 0,2,0) otherwise beats
   a plain .topbar__nav class (0,1,0) and hides the nav on desktop too —
   the ID selector wins regardless of source order. */
#topbarNav.topbar__nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.topbar__nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.topbar__nav a:hover {
  color: var(--text);
}

.theme-toggle {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 2.1rem;
  height: 2.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

@media (max-width: 575.98px) {
  .topbar__menu-toggle {
    display: flex;
  }

  #topbarNav.topbar__nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-top: 0.75rem;
  }

  #topbarNav.topbar__nav.show {
    display: flex;
  }
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  padding: 1.25rem 0;
  font-size: 0.85rem;
}

.site-footer .container {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* Converter */

.converter-hero {
  text-align: center;
  margin: 1rem 0 2.5rem;
}

.hero-eyebrow {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background-color: var(--surface);
  color: var(--accent);
  font-size: 0.8rem;
}

.converter-hero .lead {
  color: var(--text-muted);
}

.converter-app {
  max-width: 640px;
  margin: 0 auto 3rem;
  padding: 1.5rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.converter-app::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--chan-r), var(--chan-g), var(--chan-b));
  opacity: 0;
  transform: translateX(-100%);
}

.converter-app--busy::before {
  opacity: 1;
  animation: scan-sweep 1.1s ease-in-out infinite;
}

@keyframes scan-sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .converter-app--busy::before {
    animation: none;
    opacity: 1;
    transform: translateX(0);
  }
}

.converter-controls {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

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

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  background-color: var(--surface-raised);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.drop-zone--active {
  border-color: var(--accent);
  background-color: color-mix(in srgb, var(--accent) 12%, var(--surface-raised));
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.file-list__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.file-list__thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background-color: var(--surface-raised);
  flex-shrink: 0;
}

.file-list__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list__size {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.file-list__remove {
  border: none;
  background: none;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.editor-panel {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface-raised);
}

.editor-canvas-wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: 500px;
  touch-action: none;
}

.editor-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  cursor: crosshair;
}

.crop-overlay {
  position: absolute;
  border: 2px dashed var(--accent);
  background-color: color-mix(in srgb, var(--accent) 18%, transparent);
  pointer-events: none;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.result-panel {
  text-align: center;
  padding: 1.5rem;
  border: 1px solid var(--accent);
  background-color: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-radius: var(--radius-md);
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

#result-summary {
  font-family: var(--font-mono);
}

.error-panel {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--danger);
  background-color: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius-sm);
}

.converter-pairs {
  max-width: 800px;
  margin: 0 auto 2rem;
}

.pair-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.6rem;
  list-style: none;
  padding: 0;
}

.pair-links a {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
}

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

.ad-slot {
  max-width: 800px;
  margin: 1.5rem auto;
  text-align: center;
  overflow: hidden;
}

/* Consent banner */

.consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background-color: var(--surface-raised);
  border-top: 1px solid var(--border);
  color: var(--text);
}

.consent-banner__text {
  flex: 1 1 320px;
  font-size: 0.9rem;
}

.consent-banner__actions {
  display: flex;
  gap: 0.5rem;
}

/* Admin */

.admin-dashboard {
  display: grid;
  gap: 2rem;
}

.admin-stat-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.admin-stat-card {
  flex: 1 1 160px;
  padding: 1rem;
  border: 1px solid var(--border);
  background-color: var(--surface);
  border-radius: var(--radius-md);
  text-align: center;
}

.admin-stat-card__value {
  font-size: 2rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent);
}
