:root {
  --bg: #071028;
  --fg: #f5f7ff;
  --muted: #a6b3d6;
  --stroke: rgba(255, 255, 255, 0.08);
  --panel: rgba(11, 16, 32, 0.85);
  --panel-strong: rgba(5, 8, 19, 0.95);
  --accent: #7a5af8;
  --accent-strong: #ff8c6b;
  --success: #2ec27e;
  --error: #ff6b6b;
  --radius: 20px;
  --shadow-lg: 0 30px 80px rgba(2, 6, 15, 0.65);
}

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/SpaceGrotesk-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/SpaceGrotesk-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 10% 10%, rgba(124, 93, 255, 0.25), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(255, 140, 107, 0.25), transparent 40%),
    var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

img,
canvas {
  display: block;
  width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

button:focus-visible,
.tool-card:focus-visible,
.drop-zone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-hero {
  padding: clamp(2rem, 6vw, 4rem) clamp(1.25rem, 6vw, 5rem) 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  align-items: center;
}

.hero-copy h1 {
  margin: 0.4rem 0 0.5rem;
  font-size: clamp(2.25rem, 5.2vw, 3.6rem);
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.85rem;
  color: var(--accent-strong);
}

.lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

.hero-metrics {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.hero-metrics span {
  font-size: 1.25rem;
  font-weight: 600;
  display: block;
}

.hero-metrics {
  justify-content: flex-start;
  align-items: center;
  text-align: left;
}
.hero-metrics > div { text-align: left; }
.hero-metrics small { display: block; text-align: left; color: var(--muted); }

.hero-metrics .tools-label { margin-top: 0.15rem; font-weight: 600; }
.hero-metrics .tools-label small { display: inline; margin-left: 0.45rem; color: var(--muted); font-weight: 400; }

.hero-metrics small {
  color: var(--muted);
}

.hero-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1.75rem;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-lg);
}

.hero-card ul {
  list-style: none;
  margin: 0.5rem 0 1rem;
  padding: 0;
  color: var(--muted);
  display: grid;
  gap: 0.35rem;
}

.hero-card ul li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.hero-card ul li .spotlight-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.card-title,
.card-foot {
  margin: 0;
}

.card-foot {
  color: var(--accent-strong);
  font-weight: 600;
}

main {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 4rem) 4rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.tool-home {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.home-header {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
  justify-content: space-between;
}

.privacy-banner {
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  max-width: 320px;
  margin: 0;
}

.tool-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
}

.filter-menu {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.filter-chip {
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.04);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.12s ease, transform 0.12s ease;
}
.filter-chip:hover,
.filter-chip:focus {
  background: rgba(255,255,255,0.04);
  transform: translateY(-2px);
}
.filter-chip.active {
  background: linear-gradient(90deg, rgba(122,90,248,0.95), rgba(255,140,107,0.95));
  color: var(--fg);
  border-color: transparent;
  box-shadow: 0 8px 30px rgba(122,90,248,0.18);
}

.tool-card {
  background: var(--panel);
  border-radius: 18px;
  padding: 1rem; 
  border: 1px solid var(--stroke);
  box-shadow: 0 20px 45px rgba(4, 7, 18, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
  flex: 0 0 calc((100% - (3 * 1.25rem)) / 4.1);
  max-width: calc((100% - (3 * 1.25rem)) / 4.1);
  min-width: 160px;
}

.tool-card .card-heading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: flex-start;
}
.tool-card .card-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(122,90,248,0.95), rgba(255,140,107,0.95));
  box-shadow: 0 8px 20px rgba(122,90,248,0.08);
}
.tool-card .card-icon svg { display: block; width: 18px; height: 18px; }
.tool-card h3 { margin: 0; font-size: 1.05rem; }

.home-subtle {
  color: var(--muted);
  margin: 0 0 0.75rem 0;
  font-size: 1.03rem;
  text-align: center;
}

.tool-home .home-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}
.tool-home .home-header .eyebrow {
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  letter-spacing: 0.35em;
  color: var(--accent-strong);
}

/* Floating bubble navbar */
.bubble-nav { display: none; }
.bubble {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(122,90,248,0.95), rgba(255,140,107,0.95));
  color: var(--fg);
  border: none;
  box-shadow: 0 10px 24px rgba(2,6,15,0.45);
  cursor: pointer;
  font-size: 18px;
  touch-action: manipulation;
}

/* Top navigation (rounded pill) */
.top-nav {
  position: sticky;
  top: 12px;
  display: flex;
  justify-content: center;
  width: 100%;
  z-index: 99990;
  pointer-events: auto;
}
.top-nav-inner {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(8, 10, 12, 0.92);
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 8px 22px rgba(2,6,15,0.45);
}
.top-nav-links { display: flex; gap: 0.75rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.top-nav-links a { color: var(--fg); text-decoration: none; padding: 0.6rem 0.95rem; border-radius: 999px; font-weight: 600; opacity: 0.98; display: inline-block; }
.top-nav-links a:hover, .top-nav-links a:focus { background: rgba(255,255,255,0.03); transform: translateY(-1px); }
.top-nav-links a.active { background: rgba(255,140,107,0.18); color: var(--accent-strong); box-shadow: 0 6px 20px rgba(255,140,107,0.06); }
.top-nav-user { background: var(--fg); color: var(--bg); padding: 0.45rem 0.9rem; border-radius: 999px; font-weight: 700; border: 1px solid rgba(0,0,0,0.06); }

.nav-toggle { display: none; background: transparent; border: 0; color: var(--fg); }

@media (max-width:640px) {
  .top-nav-inner { padding: 0.15rem 0; gap: 0.5rem; position: relative; background: transparent; border-radius: 0; box-shadow: none; border: 0; border-bottom: 1px solid rgba(255,255,255,0.12); }
  .top-nav-user { padding: 0.35rem 0.6rem; font-size: 0.92rem; }
  .top-nav-links a { padding: 0.45rem 0.55rem; font-size: 0.95rem; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--fg); border: 0; font-size: 20px; cursor: pointer; padding: 0.25rem 0.6rem; border-radius: 10px; position: absolute; left: 0.75rem; top: 0.5rem; z-index: 2000; margin: 0; }
  .top-nav-links { display: none; flex-direction: column; gap: 0; position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: rgba(255,255,255,0.03); padding: 0.5rem; border-radius: 12px; border: 1px solid rgba(255,255,255,0.04); box-shadow: 0 12px 30px rgba(0,0,0,0.6); }
  .top-nav.open .top-nav-links { display: flex; }
  .top-nav-links li { width: 100%; }
  .top-nav-links a { display: block; width: 100%; text-align: center; }
}
.bubble:hover { transform: translateY(-3px); }
.visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }

/* Modal */
.modal-overlay {
  display: none; 
}

.about-modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 15, 0.6);
  z-index: 100000;
  padding: 1.25rem;
}
.about-modal-dialog {
  position: relative;
  width: min(1100px, 96%);
  max-width: 1100px;
  margin: 2.5rem auto;
  background: var(--panel-strong);
  color: var(--fg);
  border-radius: 10px;
  padding: 2rem 2.25rem;
  border: 1px solid rgba(6,8,18,0.06);
  box-shadow: 0 40px 120px rgba(2,6,15,0.7);
}
.about-modal-body { max-height: 65vh; overflow: auto; }
.about-header { display: flex; gap: 1rem; align-items: center; margin-bottom: 0.75rem; }
.about-logo { width: 72px; height: 72px; flex: 0 0 72px; }
.about-modal-close { position: absolute; right: 0.8rem; top: 0.6rem; background: transparent; border: 0; color: var(--fg); font-size: 26px; cursor: pointer; }
.about-actions { display: flex; justify-content: flex-end; margin-top: 1.25rem; }
.about-close-btn { background: linear-gradient(90deg, var(--accent), var(--accent-strong)); border: 0; color: white; padding: 0.6rem 1rem; border-radius: 10px; font-weight: 700; cursor: pointer; }

/* Page-like typography inside the about modal */
.about-page h1 { margin: 0 0 0.25rem; font-size: 1.5rem; color: var(--accent-strong); }
.about-page h2 { margin-top: 1.25rem; font-size: 1.125rem; color: var(--accent-strong); }
.about-page h3 { margin-top: 1rem; font-size: 1rem; color: var(--accent-strong); }
.about-page p { color: var(--fg); line-height: 1.6; }
.about-page .lead { font-size: 1.05rem; color: var(--fg); }
.about-page ul { margin-left: 1.1rem; }

/* Feedback icons (reuse about modal visuals) */
.feedback-icons { display: flex; justify-content: center; gap: 0.75rem; margin-top: 1rem; }
.feedback-icons a { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,0.25); overflow: hidden; }
.feedback-icons a img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Highlighted feedback links (name, email) and external icon */
.feedback-link { color: var(--accent-strong); font-weight: 700; text-decoration: none; }
.external-icon { width: 16px; height: 16px; margin-left: 8px; vertical-align: middle; display: inline-block; }
.about-page .external-icon { filter: none; }

/* Center the sharing line inside the feedback modal */
.sharing-line { text-align: center; margin-top: 0.75rem; font-style: italic; color: var(--muted); }

@media (max-width: 640px) {
  .about-modal-dialog { width: calc(100% - 24px); margin: 1rem 12px; padding: 1rem; }
  .about-logo { width: 56px; height: 56px; }
  .about-modal-close { color: var(--muted); }
}

/* Full-bleed About page on large screens */
@media (min-width: 1200px) {
  .about-modal-overlay { padding: 0; }
  .about-modal-dialog {
    width: 100%;
    max-width: none;
    margin: 48px 0;
    border-radius: 0;
    padding-left: 3rem;
    padding-right: 3rem;
  }
}

@media (max-width: 640px) {
  .about-modal-dialog { max-height: calc(100vh - 40px); padding: 1rem; }
  .about-logo { width: 46px; height: 46px; }
}


* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) rgba(255,255,255,0.03);
}

/* WebKit-based browsers */
*::-webkit-scrollbar { width: 12px; height: 12px; }
*::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); border-radius: 12px; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-radius: 12px;
  border: 6px solid rgba(255,255,255,0.03);
  background-clip: padding-box;
  min-height: 18px;
}

/* Slightly larger thumb in the preview pane for visibility */
.preview-container::-webkit-scrollbar { width: 14px; }
.preview-container::-webkit-scrollbar-thumb {
  border-radius: 14px;
  border: 7px solid rgba(255,255,255,0.03);
  background-clip: padding-box;
  min-height: 18px;
}

/* Ensure modal content scrollbars match when open */
.about-modal-body { scrollbar-width: thin; scrollbar-color: var(--accent) rgba(255,255,255,0.03); }
.about-modal-body::-webkit-scrollbar { width: 10px; }
.about-modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-radius: 10px;
  border: 5px solid rgba(255,255,255,0.03);
  background-clip: padding-box;
  min-height: 16px;
}

html, body, main { scrollbar-gutter: stable; }
main { padding-right: 1rem; }
.preview-container, .tool-controls { padding-right: 1rem; }
.about-modal-body { padding-right: 2.5rem; }

@media (max-width:640px) {
  .bubble-nav { right: 0.75rem; bottom: 0.75rem; }
  .bubble { width:46px; height:46px; font-size:16px; }
}

@media (max-width:640px) {
  .hero-metrics span { font-size: 1.05rem; }
  .hero-metrics small { font-size: 0.85rem; }
}
.tool-card:hover,
.tool-card:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.3);
}

.tool-card button {
  align-self: flex-start;
}

.stage {
  width: 100%;
}

#upload-stage {
  margin-top: 1.25rem;
}

@media (max-width:640px) {
  #upload-stage {
    margin-top: 0.6rem;
  }
}

#upload-back-btn {
  position: relative;
  top: -8px;
}

@media (max-width:640px) {
  #upload-back-btn { top: -6px; }
}

.stage-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.stage-summary {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.stage-actions,
.workspace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

#tool-controls input[type="color"],
#tool-controls input#pnum-color {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #cfcfcf; 
  background: transparent;
  box-sizing: border-box;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

#tool-controls input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 50%;
}
#tool-controls input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

#workspace .workspace-actions #workspace-switch-btn,
#workspace .workspace-actions #workspace-change-btn,
#tool-controls-action-btn,
#tool-action-btn {
  border: 3px solid var(--accent-strong);
  box-shadow: 0 8px 24px rgba(255, 140, 107, 0.12);
  border-radius: 10px;
}
#workspace .workspace-actions #workspace-switch-btn:hover,
#workspace .workspace-actions #workspace-change-btn:hover,
#tool-controls-action-btn:hover,
#tool-action-btn:hover {
  background: rgba(255, 140, 107, 0.06);
}

.privacy-callout {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.drop-zone {
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 18px;
  padding: 1.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(124, 93, 255, 0.12), rgba(255, 133, 102, 0.12));
}

.drop-zone.dragover {
  border-color: var(--accent);
}

.drop-title {
  font-weight: 600;
  margin: 0;
}

.drop-sub {
  margin: 0;
  color: var(--muted);
}

.primary,
.ghost {
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  font-family: inherit;
}

.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: var(--fg);
  box-shadow: 0 15px 30px rgba(124, 93, 255, 0.35);
}

.primary.soft {
  font-size: 0.95rem;
  padding: 0.5rem 1.5rem;
  border-radius: 12px;
}

.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.primary:not(:disabled):hover,
.ghost:hover {
  transform: translateY(-1px);
}

.queue-actions {
  display: flex;
  justify-content: flex-end;
}

.more-files-actions {
  margin: 0 0 0.75rem 0;
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.01);
  border: 1px solid rgba(255,255,255,0.02);
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  max-width: 420px;
  flex-basis: auto;
  margin-left: auto;
}

.more-files-actions .more-actions { display: flex; gap: 0.5rem; justify-content: flex-start; }
.more-files-actions .microcopy { margin: 0; color: var(--muted); opacity: 0.9; }

@media (max-width:640px) {
  .more-files-actions { padding: 0.5rem; }
  .more-files-actions .more-actions { justify-content: center; }
}

/* Tool card icon */
.tool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 1rem;
}
.card-icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex: 0 0 auto;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04) inset;
}
.card-icon svg { width: 28px; height: 28px; display: block; }
.card-icon i { font-size: 20px; color: #fff; display: inline-block; line-height: 1; }
.card-content { display: flex; flex-direction: column; gap: 6px; }
.card-title { margin: 0; font-size: 1rem; line-height: 1.1; }
.card-summary { margin: 0; color: var(--muted); font-size: 0.875rem; }

@media (max-width: 640px) {
  .tool-card {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 12px;
    padding: 0.6rem;
  }
  .card-icon { width: 40px; height: 40px; border-radius: 8px; }
  .card-content { flex: 1 1 auto; }
  .card-title { font-size: 0.95rem; }
  .card-summary { margin-top: 6px; font-size: 0.85rem; }
}

/* Color coding per tool (background colors) */
.icon-merge { background: linear-gradient(180deg,#6C63FF,#6057E6); }
.icon-split, .icon-extract { background: linear-gradient(180deg,#FF8A65,#FF7043); }
.icon-rotate { background: linear-gradient(180deg,#4DB6AC,#43A082); }
.icon-unlock { background: linear-gradient(180deg,#FFD54F,#FFCA28); }
.icon-watermark { background: linear-gradient(180deg,#B39DDB,#9F86D0); }
.icon-compress { background: linear-gradient(180deg,#90CAF9,#64B5F6); }
.icon-export-images, .icon-images-to-pdf { background: linear-gradient(180deg,#A5D6A7,#81C784); }
.icon-default { background: linear-gradient(180deg,#ECEFF1,#CFD8DC); }

.card-icon svg path,
.card-icon svg circle,
.card-icon svg rect { stroke: rgba(255,255,255,0.96); fill: rgba(255,255,255,0.06); }

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 280px;
  overflow-y: auto;
}

.file-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.file-entry header {
  margin: 0;
  font-weight: 600;
}

.file-meta {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.file-actions {
  display: flex;
  gap: 0.35rem;
}

.file-actions button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--fg);
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}

.file-entry[aria-pressed="true"] {
  border-color: var(--accent);
}

.workspace-final {
  background: var(--panel);
  flex-direction: column;
  gap: 1rem;
  flex-direction: column;
  gap: 1.5rem;
}

.workspace-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 1.5rem;
  align-items: flex-start;
}

.workspace-actions {
  justify-content: flex-start;
}

.workspace-summary {
  color: var(--muted);
  margin: 0.4rem 0 0;
}

.workspace-status {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.state-chip {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.state-chip[data-state="processing"] {
  border-color: var(--accent);
  color: var(--accent);
}

.state-chip[data-state="ready"],
.state-chip[data-state="done"] {
  border-color: var(--success);
  color: var(--success);
}

.state-chip[data-state="error"] {
  border-color: var(--error);
  color: var(--error);
}

.workspace-columns {
  display: grid;
  grid-template-columns: 4fr 1fr;
  gap: 1.5rem;
  min-height: 420px;
  overflow: hidden;
}

.preview-pane {
  border: 0;
  border-radius: 0;
  padding: 0.5rem 0;
  flex: 1;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 100%;
}

/* Custom scrollbar for preview column (webkit + Firefox) */
.preview-pane {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) rgba(255,255,255,0.02);
}
.preview-pane::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
.preview-pane::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
}
.preview-pane::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-radius: 10px;
  border: 3px solid rgba(0,0,0,0);
  background-clip: padding-box;
}
.preview-pane::-webkit-scrollbar-thumb:hover {
  filter: brightness(1.05);
}

.workspace-header.sticky-header + .workspace-columns .preview-pane {
  padding-top: 0;
}

.preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  width: 100%;
}

.workspace-final {
  padding: clamp(1.25rem, 3vw, 2rem);
}

#workspace {
  margin-top: 1.5rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.preview-page {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  position: relative;
}
.preview-page header {
  font-weight: 600;
  margin: 0;
  padding-right: 2.4rem;
  min-height: 1.4rem;
}
.preview-page canvas {
  border-radius: 6px;
  width: 100% !important;
  height: auto !important;
  display: block;
  background: #fff;
}

/* Move handle indicator for multi-file previews */
.move-handle {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(255, 133, 27, 0.18);
  color: #ffbf70;
  border: 1px solid rgba(255, 133, 27, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  letter-spacing: -0.05em;
  pointer-events: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.move-handle span {
  font-weight: 600;
}
.move-handle.move-inline {
  position: static;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  margin-right: 0.45rem;
  box-shadow: none;
  background: rgba(255, 133, 27, 0.25);
  border-color: transparent;
}

@media (max-width: 840px) {
  .preview-page { width: 100%; }
}

@media (max-width: 480px) {
  .preview-page { width: 100%; }
}
.tool-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-info {
  background: rgba(225, 245, 255, 0.95);
  color: #062f44;
  border-radius: 10px;
  padding: 1rem;
  border: 1px solid rgba(6, 63, 92, 0.06);
}
.control-info p { margin: 0; line-height: 1.4; }

.tool-controls .form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.microcopy.drag-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: var(--muted);
  flex-wrap: wrap;
}
.microcopy.drag-hint strong {
  color: var(--fg);
  font-weight: 600;
}

.tool-controls .form-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
.tool-controls .form-field.inline {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 120px;
  flex: 0 1 auto;
}
.tool-controls .form-field.inline label {
  white-space: nowrap;
  font-size: 0.95rem;
}
.tool-controls .form-field.inline input,
.tool-controls .form-field.inline select {
  padding: 0.45rem 0.5rem;
}

/* For color field, place label and swatch on the same line */
.tool-controls .form-field.inline.color-inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.tool-controls .form-field.inline.color-inline label {
  margin: 0;
  white-space: nowrap;
  font-weight: 600;
}
.tool-controls .form-field.inline.color-inline input[type="color"] {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
}

/* Font size inline: label and number input on same line */
.tool-controls .form-field.inline.size-inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.tool-controls .form-field.inline.size-inline label {
  margin: 0;
  white-space: nowrap;
  font-weight: 600;
}
.tool-controls .form-field.inline.size-inline input[type="number"] {
  width: 72px;
  padding: 0.35rem 0.5rem;
  text-align: center;
}

/* Orientation inline */
.tool-controls .form-field.inline.orient-inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.tool-controls .form-field.inline.orient-inline label {
  margin: 0;
  white-space: nowrap;
  font-weight: 600;
}
.tool-controls .form-field.inline.orient-inline select {
  min-width: 140px;
  padding: 0.45rem 0.5rem;
}

/* Color input */
.tool-controls input[type="color"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  cursor: pointer;
}
.tool-controls input[type="color"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tool-controls input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 999px;
}
.tool-controls input[type="color"]::-webkit-color-swatch {
  border-radius: 999px;
  border: none;
}
.tool-controls input[type="color"]::-moz-color-swatch {
  border-radius: 999px;
}

.tool-controls label {
  font-weight: 600;
}

.tool-controls input,
.tool-controls select,
.tool-controls textarea {
  background: rgba(4, 8, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: var(--fg);
  padding: 0.65rem 0.75rem;
}

.tool-controls small {
  color: var(--muted);
}

.controls-action button,
.controls-action .primary,
#tool-controls-action-btn {
  width: 100%;
  display: block;
  box-sizing: border-box;
}

/* Workspace layout */
.workspace-final {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  border-radius: 0;
  padding-left: clamp(1rem, 5vw, 2rem);
  padding-right: clamp(1rem, 5vw, 2rem);
  box-sizing: border-box;
}

.empty-preview {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.preview-page {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.02);
  position: relative;
}

.preview-page canvas {
  border-radius: 10px;
}

/* Ensure all thumbnails share the same visual box size and center their canvas */
.preview-page {
  padding: 0.75rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
}
.preview-page header {
  font-weight: 600;
  margin: 0;
  font-size: 0.95rem;
  text-align: left;
  width: 100%;
}

/* Tighter layout for merge thumbnails to remove extra top gap */
.preview-page.merge-preview {
  padding-top: 0.35rem;
  padding-bottom: 0.4rem;
  gap: 0.25rem;
}
.preview-page.merge-preview header { font-size: 0.9rem; margin: 0; padding: 0; }
.preview-page.merge-preview canvas { margin-top: 0; }

/* Drag handle inside preview header for merge reorder */
.drag-handle {
  appearance: none;
  border: 0;
  background: rgba(0,0,0,0.0);
  color: var(--muted);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 8px;
  right: 8px;
  cursor: grab;
  padding: 6px;
  border-radius: 8px;
  z-index: 5;
}
.drag-handle:active { cursor: grabbing; }
.drag-handle svg { width: 20px; height: 20px; }
.drag-handle svg path { stroke-width: 4; }

/* Icon-move: use an SVG mask so the icon takes current text color */
.icon-move {
  display: block;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  color: var(--accent-strong);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='10' y='2' width='4' height='20' fill='%23fff'/><rect x='2' y='10' width='20' height='4' fill='%23fff'/><path d='M12 0 L18 6 L6 6 Z' fill='%23fff'/><path d='M12 24 L18 18 L6 18 Z' fill='%23fff'/><path d='M0 12 L6 6 L6 18 Z' fill='%23fff'/><path d='M24 12 L18 6 L18 18 Z' fill='%23fff'/></svg>") no-repeat center / contain;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='10' y='2' width='4' height='20' fill='%23fff'/><rect x='2' y='10' width='20' height='4' fill='%23fff'/><path d='M12 0 L18 6 L6 6 Z' fill='%23fff'/><path d='M12 24 L18 18 L6 18 Z' fill='%23fff'/><path d='M0 12 L6 6 L6 18 Z' fill='%23fff'/><path d='M24 12 L18 6 L18 18 Z' fill='%23fff'/></svg>") no-repeat center / contain;
}

.drag-handle:focus .icon-move, .drag-handle:focus { outline: 2px solid rgba(255,255,255,0.12); border-radius: 8px; }

/* Modal for choosing a file when switching tools */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal-dialog {
  background: var(--panel-strong);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 1rem;
  width: min(520px, calc(100% - 3.5rem));
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.modal-dialog h3 { margin: 0 0 0.5rem 0; }
.modal-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 48vh; overflow-y: auto; margin: 0.5rem 0 0 0; padding: 0; list-style: none; }
.modal-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.02);
  background: rgba(255,255,255,0.015);
}
.modal-item:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.06);
}
.modal-item .meta { display:flex; flex-direction:column; }
.modal-cancel { margin-top: 0.75rem; display:flex; justify-content:flex-end; gap:0.5rem; }
body.modal-open #home-stage,
body.modal-open .workspace-final,
body.modal-open .site-hero,
body.modal-open .hero-card,
body.modal-open .preview-pane,
body.modal-open .controls-pane,
body.modal-open .workspace-header,
body.modal-open .site-footer,
body.modal-open .top-nav {
  filter: blur(6px) saturate(0.9);
  pointer-events: none;
  user-select: none;
}
.modal-overlay button { pointer-events: auto; }
.preview-page.dragging { opacity: 0.6; }
.preview-page.drag-over-top { border-top: 3px solid var(--accent-strong); }
.preview-page.drag-over-bottom { border-bottom: 3px solid var(--accent-strong); }
.dragging-preview .preview-page { transition: opacity 120ms ease; }
.preview-page canvas {
  width: 100% !important;
  height: auto !important;
  display: block;
  background: #fff;
  border-radius: 8px;
}

.status {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 10;
}

#status-message {
  min-width: 260px;
  padding: 0.85rem 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: var(--panel-strong);
  font-size: 0.95rem;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

#status-message:empty {
  display: none;
}

#status-message[data-tone="error"] {
  border-color: var(--error);
  color: var(--error);
}

#status-message[data-tone="success"] {
  border-color: var(--success);
  color: var(--success);
}

progress {
  width: 260px;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.1);
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.debug-panel { display: none !important; }

.site-footer {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
}

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

  .preview-pane,
  .controls-pane {
    min-height: auto;
  }
}

/* On wider viewports make the workspace area fill available vertical space
   so the preview column can scroll while the controls column stays pinned. */
@media (min-width: 841px) {
  .workspace-header {
    grid-template-columns: minmax(0, 2fr) auto;
  }

  .workspace-header .preview-header-row {
    grid-column: 1 / -1;
    margin-top: 0.35rem;
    display: flex;
    gap: 0.6rem;
    align-items: center;
    justify-content: space-between;
  }

  .workspace-columns {
    height: calc(100vh - 180px);
    /* Use a fixed-width right column for controls to avoid clipping */
    grid-template-columns: 1fr 420px;
  }
  .preview-pane {
    /* ensure previews scroll within the constrained grid area */
    overflow-y: auto;
    padding-right: 0.75rem;
  }
  /* Make the header row sticky and keep previews visually beneath it
     only when it has NOT been moved into the workspace header. When
     moved, the workspace header itself will handle stickiness. */
  .preview-header-row:not(.moved-to-header) {
    position: sticky;
    /* nudge the header slightly upward from the measured offset */
    top: calc(var(--preview-header-top-offset, 0px) - 12px);
    z-index: 120;
    display: flex;
    gap: 0.6rem;
    align-items: center;
    justify-content: space-between;
    background: var(--bg); /* match page background */
    padding: 0.12rem 0.5rem; /* slightly thinner */
    border-radius: 6px;
    box-shadow: 0 6px 14px rgba(2,6,15,0.28);
    width: 100%;
    box-sizing: border-box;
  }
  .preview-header-row .panel-head { margin: 0; }
  .preview-header-row .panel-head h3 { margin: 0; font-size: 1.05rem; line-height: 1.1; }
  .preview-header-row .more-files-actions {
    margin-left: 0.5rem;
    background: transparent;
    box-shadow: none;
    padding: 0;
  }

  /* Slightly thinner 'Upload more files' button for the preview header */
  #upload-more-btn {
    padding: 0.28rem 0.6rem;
    font-size: 0.92rem;
    min-width: 110px;
    border-radius: 10px;
  }

  .preview-container {

    padding-top: var(
      --preview-container-top-padding,
      calc(var(--preview-header-top-offset, 0px) + var(--preview-header-height, 0px) - 6px)
    );
  }
  .preview-page { position: relative; z-index: 0; }

  .preview-page {
    position: relative;
    z-index: 0;
  }
  .controls-pane {
    align-self: start;
    position: sticky;
    top: 1.5rem;
    height: fit-content;
    grid-column: 2 / 3;
    width: auto;
    max-width: 420px;
    box-sizing: border-box;
    justify-self: end;
    margin-left: 0;
    background: #000;
    border: 1px solid rgba(255,255,255,0.04);
    padding: 1.25rem;
  }

  #workspace .workspace-actions #workspace-switch-btn,
  #workspace .workspace-actions #workspace-change-btn {
    padding: 0.35rem 0.9rem;
    font-size: 0.rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    border-radius: 999px;
  }

  .top-nav-links a {
    padding: 0.45rem 0.7rem;
    font-size: 0.95rem;
  }
  .top-nav-user {
    padding: 0.35rem 0.7rem;
    font-size: 0.92rem;
  }
  .primary,
  .ghost {
    padding: 0.45rem 0.9rem;
    font-size: 0.95rem;
  }
  .more-files-actions {
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    max-width: 360px;
  }
  .file-actions button {
    padding: 0.2rem 0.45rem;
    font-size: 0.85rem;
  }
  .tool-card { padding: 1rem; }
}

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

  .preview-pane,
  .controls-pane {
    min-height: auto;
  }

  .workspace-header {
    grid-template-columns: 1fr;
  }

  .controls-pane {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 1400;
    background: #000;
    border-radius: 12px;
    border: 1px solid var(--stroke);
    box-shadow: 0 18px 40px rgba(2,6,15,0.55);
    padding: 1rem;
    max-height: 40vh;
    overflow-y: auto;
  }

  /* Make the preview header fixed at the top of the viewport on small screens */
  .preview-header-row {
    position: fixed;
    /* position under the workspace header (measured in JS) */
    top: var(--preview-header-top-viewport, 64px);
    left: 1rem;
    right: 1rem;
    z-index: 1500;
    margin-top: 0;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(2,6,15,0.45);
  }

  /* Reduce workspace header button sizes on small screens */
  .workspace-header .workspace-actions button,
  .workspace-header .workspace-actions .primary,
  .workspace-header .workspace-actions .ghost,
  #upload-more-btn,
  #workspace .workspace-actions #workspace-switch-btn,
  #workspace .workspace-actions #workspace-change-btn {
    padding: 0.28rem 0.6rem !important;
    font-size: 0.9rem !important;
    min-width: 90px !important;
    border-radius: 999px !important;
  }

  /* Slightly reduce gap between header elements */
  .workspace-header .preview-header-row,
  .workspace-header .workspace-actions { gap: 0.45rem; }

  .preview-header-row.moved-to-header {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    margin: 0;
    z-index: 1200;
    box-shadow: none;
    background: transparent;
    width: auto;
    border-radius: 6px;
    padding: 0;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.4rem;
  }

  .workspace-header.sticky-header {
    position: sticky;
    top: var(--nav-height, 56px);
    z-index: 1400;
    background: transparent;
    box-shadow: none;
    padding-bottom: 0.5rem;
  }

  .preview-container {
    padding-top: var(
      --preview-container-top-padding,
      calc(var(--preview-header-top-viewport, 64px) + var(--preview-header-height, 44px) + 8px)
    );
  }

  .controls-pane #tool-controls {
    max-height: calc(40vh - 3.5rem);
    overflow-y: auto;
  }

  .workspace-final {
    padding-bottom: calc(40vh + 2rem);
  }
}
  .lead {
    font-size: 0.95rem;
    margin-bottom: 1rem;
  }
  .hero-metrics { gap: 0.6rem; }
  .hero-card {
    order: 2;
    padding: 1rem;
    border-radius: 12px;
  }
  .hero-copy { order: 1; }

  main { padding-left: 0.75rem; padding-right: 0.75rem; }

  .home-subtle { font-size: 0.98rem; margin-bottom: 0.6rem; }/* Make the workspace action
  .tool-card-grid { gap: 0.6rem; }
  .tool-card { flex: 0 1 100%; min-width: unset; padding: 1rem; }

  .preview-container { padding: 0.5rem; }
  .preview-page { padding: 0.5rem; margin-bottom: 0.75rem; }
  .preview-page canvas { max-width: 100%; height: auto; }

  .workspace-columns { grid-template-columns: 1fr; }
  .workspace-header { align-items: stretch; }
 */
    .top-nav-inner { width: auto; max-width: calc(100% - 2rem); margin: 0 1rem; padding: 0.25rem 0.5rem; }
  .nav-toggle { order: 2; margin-left: 0.5rem; }

@media (max-width: 1000px) {
  .tool-card {
    flex: 0 1 calc((100% - 1.25rem) / 2);
    max-width: none;
  }
}

@media (max-width: 540px) {
  .tool-card {
    flex: 0 1 100%;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .site-hero,
  main {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .stage-card,
  .workspace-final {
    padding: 1.25rem;
  }

  .workspace-header {
    grid-template-columns: 1fr;
  }

  .workspace-actions {
    width: 100%;
  }

  .workspace-actions button {
    flex: 1 1 45%;
    min-width: 0;
    justify-content: center;
  }

  .workspace-status {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .status,
  .debug-panel {
    position: static;
    margin: 1rem;
  }

  progress,
  #status-message {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .hero-copy h1 {
    font-size: 2.1rem;
  }

  .workspace-header h2 {
    font-size: 1.35rem;
  }

  .workspace-summary {
    font-size: 0.95rem;
  }

  .preview-header-row,
  .preview-header-row.moved-to-header {
    padding: 0.35rem 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

main,
.site-hero,
.tool-home,
.tool-card-grid,
.tool-card,
.preview-pane,
.workspace-final {
  min-width: 0;
}

main { overflow-x: hidden; }

.top-nav-links {
  box-sizing: border-box !important;
}

.top-nav-links a { word-break: break-word; }

@media (max-width:640px) {
  .nav-toggle {
    position: absolute !important;
    left: 8px !important;
    top: 8px !important;
    margin: 0 !important;
    order: 0 !important;
    z-index: 99999 !important;
  }
}

@media (max-width:640px) {
  .top-nav-inner { background: transparent !important; box-shadow: none !important; border-bottom: 1px solid rgba(255,255,255,0.08) !important; padding: 0.5rem 0.5rem !important; }

  .top-nav-links {
    display: none !important;
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    top: 56px !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 48px) !important;
    max-width: 420px !important;
    background: #000 !important;
    color: var(--fg) !important;
    border-radius: 12px !important;
    padding: 0.25rem !important;
    box-shadow: 0 18px 36px rgba(0,0,0,0.65) !important;
    z-index: 99998 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
  }

  .top-nav.open .top-nav-links {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateX(-50%) translateY(0) !important;
  }

  .top-nav-links a { display: block !important; width: 100% !important; text-align: left !important; padding: 0.7rem 0.9rem !important; color: var(--fg) !important; }
  .top-nav-links a:hover, .top-nav-links a:focus { background: rgba(255,255,255,0.02) !important; }

  .nav-toggle { display: inline-flex !important; position: fixed !important; left: 8px !important; top: 8px !important; z-index: 99999 !important; background: rgba(0,0,0,0.12) !important; border: 0 !important; padding: 0.35rem 0.6rem !important; border-radius: 10px !important; color: var(--fg) !important; }
}
