:root {
  --bg-base: #050b14;
  --bg-panel: #0d1726;
  --bg-hover: #17263d;
  --text-main: #f1f5f9;
  --text-muted: #cbd5e1;
  --accent: #00e6ff;
  --accent-soft: rgba(0, 230, 255, 0.14);
  --border: #1e2b3c;
  --warning: #fbbf24;
  --panel-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 1px 1px rgba(255, 255, 255, 0.04);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #2a3b52 var(--bg-base);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top, rgba(0, 230, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #07111d 0%, var(--bg-base) 58%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: #000;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: #2a3b52;
  border: 2px solid var(--bg-base);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
}

.app-sidebar {
  width: 260px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease;
  z-index: 2;
}

.app-sidebar.collapsed {
  width: 72px;
}

.app-sidebar.collapsed .sidebar-header {
  justify-content: center;
}

.app-sidebar.collapsed .sidebar-logo,
.app-sidebar.collapsed .nav-text,
.app-sidebar.collapsed .sidebar-note,
.app-sidebar.collapsed .secondary-link {
  display: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo,
.sidebar-logo:visited {
  color: var(--accent);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 2px;
  font-size: 1.15rem;
}

.sidebar-logo:hover,
.dev-rainbow,
.secondary-link:hover {
  background: linear-gradient(90deg, #ff0055, #ffaa00, #00ffaa, #00aaff, #aa00ff, #ff0055);
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: rainbow-scroll 1.5s linear infinite;
}

.sidebar-toggle {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-size: 1.5rem;
  cursor: pointer;
}

.sidebar-toggle:hover {
  color: var(--warning);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 0;
  overflow-y: auto;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-btn:hover {
  background: rgba(0, 230, 255, 0.06);
  color: var(--text-main);
}

.nav-btn.active {
  color: var(--accent);
  background: rgba(0, 230, 255, 0.1);
  border-left-color: var(--accent);
}

.nav-icon {
  min-width: 24px;
  font-size: 1.2rem;
  text-align: center;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
}

.sidebar-note {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.secondary-link {
  color: #a855f7;
  text-decoration: none;
  font-weight: 700;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 30px 40px;
  background: radial-gradient(circle at 50% 0%, #0d1b2a 0%, var(--bg-base) 80%);
}

.main-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.app-title {
  margin: 0;
  color: var(--accent);
  letter-spacing: 1.6px;
  font-size: clamp(2rem, 2.8vw, 3rem);
}

.maintainer {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.header-chip {
  white-space: nowrap;
  padding: 10px 14px;
  border: 1px solid rgba(0, 230, 255, 0.32);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(0, 230, 255, 0.06);
  font-weight: 700;
}

.app-view {
  animation: fade-in 0.25s ease;
}

.app-view[hidden] {
  display: none;
}

.panel {
  background: linear-gradient(180deg, rgba(13, 23, 38, 0.98), rgba(9, 18, 31, 0.98));
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--panel-shadow);
}

.hero-panel,
.tools-overview-panel,
.qr-panel {
  padding: 28px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow,
label {
  margin: 0 0 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 0.8rem;
  font-weight: 700;
}

.section-title {
  margin: 0 0 12px;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.section-desc {
  margin: 0;
  color: #9fb0c7;
  line-height: 1.7;
}

.hero-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.microcopy,
.status-text,
.range-value {
  color: var(--text-muted);
}

.hero-stats {
  display: grid;
  gap: 14px;
}

.stat-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(0, 230, 255, 0.12);
  background: linear-gradient(180deg, rgba(0, 230, 255, 0.08), rgba(255, 255, 255, 0.02));
}

.stat-label {
  display: block;
  color: #9fb0c7;
  font-size: 0.85rem;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 1.05rem;
}

.panel-heading {
  margin-bottom: 18px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  color: var(--text-main);
  text-align: left;
}

button.tool-card {
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

button.tool-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 230, 255, 0.45);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

.tool-card-active {
  background: linear-gradient(180deg, rgba(0, 230, 255, 0.12), rgba(255, 255, 255, 0.02));
}

.tool-card-placeholder {
  opacity: 0.8;
}

.tool-card-icon {
  font-size: 1.6rem;
  color: var(--accent);
}

.tool-card-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.tool-card-copy {
  color: #aebed3;
  line-height: 1.6;
}

.qr-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 360px);
  gap: 24px;
  align-items: start;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.95fr);
  gap: 24px;
  align-items: start;
}

.qr-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opacity-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.matrix-input,
.qr-textarea,
.color-input,
.primary-btn,
.secondary-btn {
  font: inherit;
}

.matrix-input,
.qr-textarea,
.color-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #010409;
  color: var(--accent);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.matrix-input:focus,
.qr-textarea:focus,
.color-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 230, 255, 0.1);
}

.qr-textarea {
  resize: vertical;
  min-height: 180px;
}

.color-input {
  min-height: 48px;
  padding: 6px;
}

input[type="range"].matrix-input {
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  min-height: 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

input[type="range"].matrix-input:focus {
  border: 0;
  box-shadow: none;
}

input[type="range"].matrix-input::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: #00c3ff;
  border: 0;
}

input[type="range"].matrix-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: #00e6ff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

input[type="range"].matrix-input::-moz-range-track {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: #00c3ff;
}

input[type="range"].matrix-input::-moz-range-progress {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: #00c3ff;
}

input[type="range"].matrix-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #00e6ff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  font-weight: 600;
}

.inline-toggle input {
  width: auto;
}

.primary-btn,
.secondary-btn {
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, filter 0.15s ease, border-color 0.2s ease;
}

.primary-btn {
  color: #001018;
  background: linear-gradient(135deg, var(--accent), #6cf4ff);
}

.secondary-btn {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.qr-preview-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid rgba(0, 230, 255, 0.12);
  background: linear-gradient(180deg, rgba(0, 230, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.output-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid rgba(0, 230, 255, 0.12);
  background: linear-gradient(180deg, rgba(0, 230, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.fancy-layout .output-panel {
  min-height: 0;
  max-height: 70vh;
  overflow: hidden;
}

.preview-shell {
  width: 100%;
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 18px;
  border-radius: 18px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.025) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.025) 75%);
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.image-preview-shell {
  min-height: 360px;
}

#qrCanvas {
  width: min(100%, 320px);
  height: auto;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.barcode-preview-shell {
  min-height: 280px;
}

#barcodeCanvas {
  width: min(100%, 420px);
  height: auto;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
}

.image-preview {
  max-width: 100%;
  max-height: 320px;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.output-textarea {
  color: var(--text-main);
  font-family: Consolas, "Courier New", monospace;
}

.progress-section {
  display: grid;
  gap: 10px;
}

.progress-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00e6ff, #6cf4ff);
  transition: width 0.12s linear;
}

.error-text {
  color: #fbbf24;
  margin: 0;
  line-height: 1.5;
}

.json-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
}

.json-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(0, 230, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.json-tool-btn {
  border: 0;
  background: transparent;
  color: #9fb0c7;
  text-align: left;
  padding: 8px 6px;
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.json-tool-btn:hover,
.json-tool-btn.active {
  color: var(--accent);
  transform: translateX(2px);
}

.json-main {
  min-width: 0;
}

.json-tool-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr);
}

.json-viewer {
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #010409;
  color: var(--text-main);
  font-family: Consolas, "Courier New", monospace;
}

.fancy-layout {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: stretch;
}

.fancy-results {
  display: grid;
  gap: 12px;
  overflow-y: auto;
  max-height: 60vh;
  padding-right: 6px;
}

.fancy-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.fancy-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fancy-card-title {
  color: var(--accent);
  font-weight: 700;
}

.fancy-card-text {
  color: var(--text-main);
  font-size: 1.05rem;
  line-height: 1.5;
  word-break: break-word;
}

.copy-mini-btn {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.copy-mini-btn:hover {
  border-color: rgba(0, 230, 255, 0.4);
}

.timestamp-preview {
  min-height: 68px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #010409;
  color: var(--text-main);
  display: flex;
  align-items: center;
  line-height: 1.6;
}

.webhook-mode-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 8px;
  margin-bottom: 20px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.webhook-tab-btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 18px;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.webhook-tab-btn.active {
  background: #5865f2;
  border-color: rgba(255, 255, 255, 0.35);
}

.webhook-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.three-col-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.webhook-color-grid {
  grid-template-columns: 120px minmax(0, 1fr);
}

.webhook-preview-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.webhook-preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.webhook-preview-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, #5865f2, #7c84ff);
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}

.webhook-preview-name {
  font-weight: 700;
}

.webhook-preview-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.webhook-preview-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.webhook-preview-content-muted {
  color: var(--text-muted);
}

.discord-embed-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-left: 4px solid #5865f2;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.discord-embed-title {
  font-weight: 700;
  color: #ffffff;
}

.discord-embed-author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

.discord-embed-author-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}

.discord-embed-author-name {
  color: #ffffff;
  text-decoration: none;
}

.discord-embed-author-name:hover {
  text-decoration: underline;
}

.discord-embed-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.discord-embed-main {
  min-width: 0;
}

.discord-embed-description {
  color: #d7e3f1;
  white-space: pre-wrap;
  word-break: break-word;
}

.discord-embed-thumbnail {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}

.discord-embed-image {
  width: 100%;
  min-height: 160px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  background-size: cover;
  background-position: center;
}

.discord-embed-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.discord-embed-field {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.discord-embed-field.inline {
  grid-column: span 1;
}

.discord-embed-field:not(.inline) {
  grid-column: 1 / -1;
}

.discord-embed-field-name {
  font-weight: 700;
  margin-bottom: 6px;
}

.discord-embed-field-value {
  color: #d7e3f1;
  white-space: pre-wrap;
  word-break: break-word;
}

.discord-embed-footer {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.webhook-fields-list {
  display: grid;
  gap: 12px;
}

.webhook-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto auto;
  gap: 10px;
  align-items: center;
}

.webhook-inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  font-weight: 600;
  white-space: nowrap;
}

.delete-field-btn,
.add-field-btn {
  align-self: start;
}

.delete-field-btn {
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.delete-field-btn:hover {
  border-color: rgba(239, 68, 68, 0.8);
}

.json-node {
  margin-left: 16px;
}

.json-node details {
  margin: 6px 0;
}

.json-key {
  color: #6cf4ff;
}

.json-string {
  color: #fbbf24;
}

.json-number {
  color: #86efac;
}

.json-boolean {
  color: #f472b6;
}

.json-null {
  color: #94a3b8;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rainbow-scroll {
  to {
    background-position: 200% center;
  }
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .app-layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .app-sidebar,
  .app-sidebar.collapsed {
    width: 100%;
  }

  .app-sidebar.collapsed .nav-text,
  .app-sidebar.collapsed .sidebar-note,
  .app-sidebar.collapsed .secondary-link,
  .app-sidebar.collapsed .sidebar-logo {
    display: initial;
  }

  .app-main {
    padding: 22px 16px 40px;
  }

  .main-header,
  .hero-panel,
  .qr-layout,
  .tool-layout,
  .json-layout,
  .json-tool-layout {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .three-col-grid,
  .webhook-color-grid,
  .webhook-field-row {
    grid-template-columns: 1fr;
  }

  .discord-embed-body {
    grid-template-columns: 1fr;
  }

  .main-header {
    align-items: start;
  }

}

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

  .hero-panel,
  .tools-overview-panel,
  .qr-panel {
    padding: 20px;
  }

  .preview-shell {
    min-height: 260px;
  }

  .image-preview-shell {
    min-height: 260px;
  }

}
