@font-face {
  font-family: "nudicamono-regular";
  src:
    url("../../nudicamono-regular-webfont.woff2") format("woff2"),
    url("../../nudicamono-regular-webfont.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #000000;
  color: #f1f1f1;
  font-family: "nudicamono-regular", "Courier New", Courier, monospace;
}

.noscript-fallback {
  padding: 40px;
  text-align: center;
  color: #f1f1f1;
  font-family: "nudicamono-regular", "Courier New", Courier, monospace;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  color: #f1f1f1;
  z-index: 9999;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
  background: #000000;
  outline: none;
}

#canvas-container.drag-over {
  box-shadow: inset 0 0 0 4px #ffd700;
}

#canvas-container.drag-over::after {
  content: "Drop image here";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 215, 0, 0.12);
  color: #ffd700;
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  pointer-events: none;
  z-index: 10;
}

canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

@media (max-resolution: 1dppx) {
  canvas {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
  }
}

#version-badge {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1001;
  font-size: 13px;
  color: #f1f1f1;
  pointer-events: none;
}

#site-footer {
  position: fixed;
  bottom: 10px;
  left: 10px;
  z-index: 1001;
  font-size: 12px;
  color: rgba(241, 241, 241, 0.7);
  pointer-events: auto;
}

#site-footer p {
  margin: 0;
}

.qide-ui-panel {
  font-family: "nudicamono-regular", "Courier New", Courier, monospace !important;
}

/* Status bar */
.status-bar {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  max-width: calc(100% - 320px);
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid #333333;
  color: rgba(241, 241, 241, 0.8);
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}

@media (max-width: 640px) {
  .status-bar {
    max-width: calc(100% - 24px);
    bottom: 48px;
  }
}

/* UI toggle (shown in Clean UI mode) */
#ui-toggle {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1002;
  display: none;
  background: transparent;
  border: 1px solid rgba(241, 241, 241, 0.15);
  color: #f1f1f1;
  font-family: inherit;
  font-size: 11px;
  padding: 6px 12px;
  cursor: pointer;
  text-transform: uppercase;
}

#ui-toggle:hover,
#ui-toggle:focus {
  background: rgba(241, 241, 241, 0.08);
  border-color: rgba(241, 241, 241, 0.35);
  outline: none;
}

body.ui-hidden .qide-ui-panel,
body.ui-hidden #version-badge,
body.ui-hidden #site-footer,
body.ui-hidden #loading,
body.ui-hidden #status {
  display: none !important;
}

body.ui-hidden #ui-toggle {
  display: block;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 48px;
  right: 16px;
  z-index: 1003;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background-color: #111111;
  border: 1px solid #333333;
  border-left: 3px solid #ffd700;
  color: #f1f1f1;
  font-size: 12px;
  max-width: 320px;
  animation: slideIn 200ms ease-out;
}

.toast.success {
  border-left-color: #22c55e;
}

.toast.error {
  border-left-color: #ef4444;
}

.toast.warning {
  border-left-color: #f59e0b;
}

.toast-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.toast.hiding {
  animation: slideOut 200ms ease-in forwards;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Autosave banner */
.autosave-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1004;
  background: #111111;
  border-bottom: 1px solid #ffd700;
  padding: 10px 16px;
}

.autosave-banner.visible {
  display: block;
}

.autosave-banner-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
  flex-wrap: wrap;
  font-size: 13px;
  color: rgba(241, 241, 241, 0.8);
}

.autosave-banner-inner svg {
  flex-shrink: 0;
  color: #ffd700;
}

.autosave-indicator {
  position: fixed;
  bottom: 48px;
  right: 16px;
  z-index: 1003;
  background: #111111;
  color: #22c55e;
  border: 1px solid #22c55e;
  padding: 6px 10px;
  font-size: 11px;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 200ms ease,
    transform 200ms ease;
  pointer-events: none;
}

.autosave-indicator.show {
  opacity: 1;
  transform: translateY(0);
}

/* Buttons used in autosave banner */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  border: 1px solid #f1f1f1;
  background: #000000;
  color: #f1f1f1;
  cursor: pointer;
  text-transform: uppercase;
}

.btn:hover:not(:disabled),
.btn:focus {
  background: #ffd700;
  color: #000000;
  border-color: #ffd700;
  outline: none;
}

.btn-primary {
  border-color: #ffd700;
  color: #ffd700;
}

.btn-primary:hover:not(:disabled),
.btn-primary:focus {
  background: #ffd700;
  color: #000000;
}

.btn-ghost {
  border-color: rgba(241, 241, 241, 0.35);
  color: rgba(241, 241, 241, 0.8);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

/* Help modal */
.help-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1005;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 200ms ease,
    visibility 200ms ease;
}

.help-modal.active {
  opacity: 1;
  visibility: visible;
}

.help-content {
  background-color: #111111;
  border: 1px solid #f1f1f1;
  padding: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.help-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: normal;
  color: #f1f1f1;
  text-transform: uppercase;
  margin: 0;
}

.help-title svg {
  color: #ffd700;
}

.help-close {
  background: none;
  border: none;
  color: rgba(241, 241, 241, 0.6);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-close:hover,
.help-close:focus {
  color: #f1f1f1;
  outline: none;
}

.help-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #333333;
  margin-bottom: 16px;
}

.help-tab {
  padding: 8px 14px;
  font-size: 12px;
  text-transform: uppercase;
  color: rgba(241, 241, 241, 0.6);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  font-family: inherit;
}

.help-tab:hover,
.help-tab:focus {
  color: #f1f1f1;
  outline: none;
}

.help-tab.active {
  color: #ffd700;
  border-bottom-color: #ffd700;
}

.help-tab-panel {
  display: none;
}

.help-tab-panel.active {
  display: block;
  animation: fadeIn 200ms ease;
}

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

.steps-list {
  counter-reset: step-counter;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(241, 241, 241, 0.8);
}

.steps-list li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 36px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #222222;
}

.steps-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.steps-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #000000;
  background-color: #ffd700;
  line-height: 1;
}

.steps-list li strong {
  color: #f1f1f1;
}

.steps-list li kbd {
  display: inline-block;
  padding: 2px 5px;
  font-size: 11px;
  font-family: inherit;
  background-color: #222222;
  border: 1px solid #333333;
  color: #f1f1f1;
}

.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background-color: #000000;
  border: 1px solid #222222;
  font-size: 13px;
}

.shortcut-action {
  color: rgba(241, 241, 241, 0.8);
}

.shortcut-key {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.shortcut-key kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 3px 6px;
  font-size: 11px;
  font-family: inherit;
  background-color: #222222;
  border: 1px solid #333333;
  color: #f1f1f1;
}

@media (max-width: 640px) {
  .help-content {
    padding: 16px;
    max-height: 90vh;
  }

  .help-title {
    font-size: 14px;
  }

  .help-tab {
    padding: 8px 10px;
    font-size: 11px;
  }

  .shortcut-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Palette */
.palette-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 28px;
  padding: 6px 0;
}

.palette-swatch {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(241, 241, 241, 0.2);
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease;
  flex-shrink: 0;
  padding: 0;
}

.palette-swatch:hover,
.palette-swatch:focus {
  transform: scale(1.1);
  border-color: #f1f1f1;
  outline: none;
}

.palette-empty {
  color: rgba(241, 241, 241, 0.5);
  font-size: 11px;
  margin: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
