/* Consolidated RetroCut styles: assets/css/global.css + imagestudio.css */

:root {
  --blue:   #0099CC;
  --yellow: #FFCC33;
  --ui-slider-accent: var(--yellow);
  --white:  #FDFDF9;
  --text-dark: #1A1A1A;
  --graphite: #393939;
  --red:    #c03221;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* Prevents horizontal scrollbars globally */
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-dark);
  background: radial-gradient(circle at top, #00a8dd 0%, #0099CC 48%, #0081aa 100%);
  
  /* STICKY FOOTER SETUP */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.mobile-blocker {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: rgba(16, 20, 24, 0.92);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.mobile-blocker[hidden] {
  display: none !important;
}

.mobile-blocker-card {
  width: min(92vw, 420px);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #1f262d;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.42);
  padding: 18px 16px;
  text-align: center;
}

.mobile-blocker-card h2 {
  margin: 0 0 10px;
  color: #f5f9ff;
  font-size: 1.18rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.mobile-blocker-card p {
  margin: 0;
  color: rgba(245, 249, 255, 0.9);
  font-size: 0.93rem;
  line-height: 1.45;
}

.mobile-blocker-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.mobile-blocker-continue {
  min-width: 120px;
  border: 1px solid #0099cc;
  border-radius: 10px;
  background: #0099cc;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  padding: 9px 14px;
  cursor: pointer;
}

.mobile-blocker-continue:hover {
  background: #0089b8;
  border-color: #0089b8;
}

/* ----------------------------------------------------------
   HEADER (shared)
---------------------------------------------------------- */
header {
  background: #ffffff;
  color: var(--text-dark);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 8px 22px rgba(0,0,0,0.08);
  position: relative;
  z-index: 10;
}

.header-brand {
  white-space: nowrap;
}

.header-text-title {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--blue);
  text-transform: uppercase;
  display: inline-flex;
  align-items: flex-start;
  gap: 0.03em;
}

.z-icon img {
  height: 1.1em;
  width: auto;
  margin-top: 8px;
  margin-left: -6px;
  margin-right: -5px;
}

/* Subtitle */
.header-sub {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
}

.header-sub img {
  width: 220px; 
  height: auto;
  display: block;
}

.header-text-subtitle {
  font-size: 0.85rem !important; 
  font-weight: 500;
  color: #555; 
  letter-spacing: 0.02em; 
  margin-top: 8px; 
  max-width: 600px;
  line-height: 1.4;
}

/* Right side (language selector) */
.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

/* ----------------------------------------------------------
   LANGUAGE TOGGLE
---------------------------------------------------------- */
.lang-toggle {
  display: inline-flex;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.12);
  background: #ffffff;
}

.lang-btn {
  border: none;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  background: transparent;
  color: var(--text-dark);
  cursor: pointer;
}

.lang-btn + .lang-btn {
  border-left: 1px solid rgba(0,0,0,0.08);
}

.lang-btn.active {
  background: rgba(0,153,204,0.12);
  color: var(--blue);
  font-weight: 600;
}

/* ----------------------------------------------------------
   HEADER MOBILE
---------------------------------------------------------- */
@media (max-width: 800px) {
  header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-brand {
    align-self: center;
  }

  .header-sub {
    order: 3;
    margin-top: 6px;
  }

  .header-right {
    width: 100%;
    justify-content: center;
  }
}

/* ----------------------------------------------------------
   YELLOW MENU BAR
---------------------------------------------------------- */
.app-menu-bar {
  background: var(--yellow);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18); 
  position: relative;
  z-index: 150;
}

.app-menu-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 6px 24px;
  display: flex;
  justify-content: flex-end;
}

/* ----------------------------------------------------------
   NAVIGATION
---------------------------------------------------------- */
.main-nav {
  font-size: 0.75rem;
}

.nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.nav-link,
.nav-link--button {
  appearance: none;
  border: none;
  outline: none;
  background: transparent;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 500;
  color: var(--graphite);
  cursor: pointer;
  text-decoration: none;
  font-size: 1.00rem;
}

.nav-link:hover,
.nav-link--button:hover {
  background: rgba(255,255,255,0.35);
}

.nav-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* Dropdown */
.nav-item {
  position: relative;
}

.nav-submenu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  list-style: none;
  margin: 0;
  padding: 6px 0;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  min-width: 150px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
  transform: translateY(-4px);
  z-index: 300;
}

.nav-submenu a {
  display: block;
  padding: 6px 14px;
  text-decoration: none;
  font-weight: 500;
  color: var(--text-dark);
  font-size: 0.86rem;
}

.nav-submenu a:hover {
  background: rgba(0,0,0,0.04);
}

.nav-item:hover > .nav-submenu,
.nav-item:focus-within > .nav-submenu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Mobile */
@media (max-width: 800px) {
  .app-menu-inner {
    justify-content: center;
  }
  .nav-list {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ----------------------------------------------------------
   MAIN CONTENT AREAS
   These flex: 1 to push the footer down naturally
---------------------------------------------------------- */
main, 
.landing-main, 
.page-main {
  flex: 1;
  width: 100%;
}

.landing-main {
  max-width: 1180px;
  margin: 32px auto 40px;
  padding: 0 16px 16px;
  margin-top: 24px;   
}

/* THE FIX: 
   Use Padding for vertical spacing, NOT margin.
   Margin on a 100% height container forces scrollbars.
   Padding keeps the spacing 'inside' the flexible area.
*/
.page-main {
  width: 100%;
  max-width: 1100px;
  
  /* Center Horizontal */
  margin: 0 auto; 
  
  /* Top padding provides the visual gap from the header */
  padding: 48px 20px 32px; 
}

/* ----------------------------------------------------------
   FOOTER (shared)
---------------------------------------------------------- */
footer {
  text-align: center;
  padding: 18px 12px 26px;
  font-size: 0.9rem;
  background: rgba(0,0,0,0.12);
  color: #f9fafb;
  border-top: 1px solid rgba(0,0,0,0.15);
  backdrop-filter: blur(8px);
  
  /* Pushes footer to bottom if content is extremely short */
  margin-top: auto; 
  width: 100%;
}

footer a {
  color: var(--yellow);
  font-weight: 600;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.logo-link {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
}

.logo-link:visited {
  color: inherit;
}

/* ========== APP HEADER BADGE ========== */

.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
               "Segoe UI", sans-serif;
}

/* ---------- LARGE BADGE VARIANT ---------- */

.app-badge--large {
  transform: scale(1.35);        /* scales the entire block */
  transform-origin: left center; /* keeps it aligned to the left */
}


/* Circular icon */
.app-badge__icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #FFCC33;      /* yellow circle */
  color: #0A0019;           /* dark text inside */
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.05em;
}

/* Title text: BGone in blue, no background */
.app-badge__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #0099CC;           /* Blizlab blue */
}

/* Optional: smaller version for tight headers */
.app-badge--compact .app-badge__icon {
  width: 26px;
  height: 26px;
  font-size: 0.95rem;
}

.app-badge--compact .app-badge__title {
  font-size: 1.1rem;
}


/* Shared title-bar wrapper for all Blizlab apps */
.app-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  width: 100%;
  margin-bottom: 18px;
}

/* Optional: allow subtitle pill to shrink on smaller screens */
.app-header-row .status-pill {
  white-space: nowrap;
  flex-shrink: 1;
}


/* Big white shell card */
.app-shell {
  background: #fdfdf9;
  border-radius: 26px;
  padding: 18px 20px 22px;
  box-shadow:
    0 24px 40px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.7);
}

.icon-kofi {
  width: 20px;
  height: 20px;
  vertical-align: -4px;
}

.nav-icon {
  width: 1.2em;
  height: 1.2em;
  margin-right: 6px;
  vertical-align: -0.15em;
  display: inline-block;
}

/* ----------------------------------------------------------
   NEW APP BRANDING (Modern Title)
---------------------------------------------------------- */

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px; /* Space between icon and text */
}

/* The Container for the SVG Icon */
.app-brand-icon {
  width: 40px;
  height: 40px;
  
  /* UPDATED: Blue background with radial gradient */
  background: radial-gradient(circle at center, #00a8dd 0%, var(--blue) 100%);
  
  /* UPDATED: Border adjusted to match the blue theme */
  border: 0px solid rgba(0, 153, 204, 0.3);
  
  border-radius: 10px; /* Kept squared as requested */
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* UPDATED: Shadow color changed from yellow to blue */
  box-shadow: 
    0 4px 12px rgba(0, 153, 204, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    
  /* UPDATED: Icon color set to Yellow */
  color: var(--yellow); 
  
  transition: transform 0.2s ease;
}

.app-brand:hover .app-brand-icon {
  transform: scale(1.05) rotate(-3deg);
}

/* The SVG inside the container */
.app-brand-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor; /* Inherits color from parent */
  display: block;
}

/* The Text (Chrono + Meter style) */
.app-brand-text {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
  font-size: 2.2rem;
  letter-spacing: -0.04em;
  
  /* UPDATED: First part of the word is now Graphite */
  color: var(--graphite); 
  
  line-height: 1;

  /* Blue shadow: Soft glow behind the text */
  text-shadow: 0 8px 24px rgba(0, 153, 204, 0.2);
}

/* The blue part (wrap the second half of your word in <span class="highlight">...</span>) */
.app-brand-text .highlight {
  color: var(--blue);
}

/* Optional: Highlight part of the text in Blue */
.app-brand-text .highlight {
  color: var(--blue);
}
/* ---- RetroCut app styles ---- */

/* ImageStudio: Retroit + BGone (new organized app) */

body {
  background-color: #F6F8FA;
  background-image: linear-gradient(
    to top,
    #EEF2F6 0%,
    #F3F6F8 26%,
    #F6F8FA 56%,
    #F6F8FA 100%
  );
}

.app-topbar {
  position: relative;
  height: 60px;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #2f353a;
  border-bottom: 0;
  box-shadow: none;
  z-index: 120;
}

.app-title {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
  font-weight: 800;
  color: #f5f9ff;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  cursor: default;
}

.app-title img {
  height: 32px;
  width: auto;
  display: block;
}

.logo-bolt-hit {
  position: absolute;
  left: 46px;
  top: 2px;
  width: 24px;
  height: 28px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.logo-bolt-hit:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
  border-radius: 4px;
}

.logo-sparks {
  position: absolute;
  left: 58px;
  top: 16px;
  width: 0;
  height: 0;
  pointer-events: none;
}

.logo-spark {
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: #ffcc33;
  box-shadow: 0 0 6px rgba(255, 204, 51, 0.85);
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  animation: bolt-spark 360ms ease-out forwards;
}

@keyframes bolt-spark {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scaleX(0.5);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) rotate(var(--rot, 0deg)) scaleX(1);
  }
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.layers-topbar-wrap {
  position: relative;
}

.layers-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.layers-topbar-actions .layers-head-btn,
.layers-topbar-actions .layers-menu-btn,
.layers-topbar-actions .layers-add-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(236, 243, 247, 0.92);
}

.layers-topbar-actions .layers-head-btn img,
.layers-topbar-actions .layers-add-btn img {
  width: 17px;
  height: 17px;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.layers-topbar-actions .layers-menu-btn {
  --layers-menu-icon-color: rgba(236, 243, 247, 0.92);
}

.layers-topbar-actions .layers-head-btn:hover,
.layers-topbar-actions .layers-menu-btn:hover,
.layers-topbar-actions .layers-add-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(236, 243, 247, 0.26);
}

.layers-topbar-actions .layers-head-btn:disabled,
.layers-topbar-actions .layers-menu-btn:disabled,
.layers-topbar-actions .layers-add-btn:disabled {
  color: rgba(236, 243, 247, 0.45);
  opacity: 1;
}

.layers-topbar-actions .layers-head-btn:disabled img,
.layers-topbar-actions .layers-add-btn:disabled img {
  opacity: 0.45;
}

.layers-topbar-actions .layers-head-btn.is-active,
.layers-topbar-actions .layers-menu-btn.is-active {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(236, 243, 247, 0.32);
  color: #ffffff;
}

#btnMergeVisibleLayers {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(236, 243, 247, 0.92);
  padding: 0;
}

#btnMergeVisibleLayers img {
  width: 17px;
  height: 17px;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

#btnMergeVisibleLayers:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(236, 243, 247, 0.26);
  color: rgba(236, 243, 247, 0.92);
  text-shadow: none;
}

#btnMergeVisibleLayers:disabled {
  color: rgba(236, 243, 247, 0.45);
}

#btnMergeVisibleLayers:disabled img {
  opacity: 0.45;
}

.layers-topbar-wrap .layers-head-menu {
  border-color: rgba(236, 243, 247, 0.22);
  background: #2b333b;
  color: rgba(236, 243, 247, 0.95);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.42);
}

.layers-topbar-wrap .layers-bg-row input[type="color"],
.layers-topbar-wrap .layers-bg-row input[type="text"] {
  border-color: rgba(236, 243, 247, 0.26);
  background: #222b33;
  color: rgba(236, 243, 247, 0.95);
}

.topbar-menu-btn {
  height: 38px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: rgba(238, 243, 247, 0.86);
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 150ms ease, text-shadow 150ms ease;
}

#aboutToggleBtn {
  font-weight: 500;
}

.topbar-menu-btn:hover,
.topbar-menu-btn.is-open {
  color: #ffffff;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.35);
}

.topbar-menu-btn:disabled {
  cursor: default;
  color: rgba(238, 243, 247, 0.42);
  text-shadow: none;
}

.topbar-menu-btn img {
  width: 16px;
  height: 16px;
  display: block;
  filter: brightness(0) saturate(100%) invert(94%) sepia(7%) saturate(542%) hue-rotate(175deg) brightness(104%) contrast(98%);
  opacity: 0.86;
  transition: opacity 150ms ease;
}

.topbar-menu-btn:hover img,
.topbar-menu-btn.is-open img {
  opacity: 1;
}

.topbar-menu-btn:disabled img {
  opacity: 0.4;
}

.topbar-menu-btn .menu-icon-up,
.topbar-menu-btn .menu-icon-down {
  display: none;
}

.topbar-menu-btn[aria-expanded="true"] .menu-icon-up {
  display: block;
}

.topbar-menu-btn[aria-expanded="false"] .menu-icon-down {
  display: block;
}

.topbar-more-wrap {
  position: relative;
}

.topbar-icon-btn {
  width: 38px;
  padding: 0;
  justify-content: center;
}

.topbar-icon-btn .menu-main-icon {
  width: 20px;
  height: 20px;
}

.topbar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, 92vw);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #ffffff;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.16);
  padding: 12px;
  z-index: 180;
}

.topbar-dropdown[hidden] {
  display: none !important;
}

.more-menu .definition-chips {
  margin-top: 6px;
  margin-bottom: 8px;
}

.more-menu .chip-btn {
  padding: 4px 10px;
  font-size: 0.86rem;
}

.more-menu .setting-note {
  margin-top: 9px;
  margin-bottom: 10px;
  line-height: 1.45;
}

.topbar-dropdown.more-menu {
  border-radius: 0;
  border: 1px solid rgba(236, 243, 247, 0.16);
  background: #2f353a;
  box-shadow: none;
}

.more-menu .menu-title-bar {
  margin: -12px -12px 10px;
  min-height: 34px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(236, 243, 247, 0.16);
}

.more-menu .menu-title {
  color: rgba(236, 243, 247, 0.92);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.sidebar .menu-title-bar.sidebar-title-bar {
  margin: 0 -10px 6px;
  min-height: 34px;
  padding: 0 10px;
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(236, 243, 247, 0.16);
}

.sidebar .controls-group > .menu-title-bar.sidebar-title-bar:first-child {
  margin-top: -4px;
}

.sidebar .menu-title-bar.sidebar-title-bar .sidebar-section-title {
  margin-bottom: 0;
}

.sidebar .menu-title-bar.sidebar-title-bar + .sidebar-action-list {
  margin-top: 0;
}

.sidebar .file-name + .menu-title-bar.sidebar-title-bar {
  margin-top: 2px;
}

.more-menu .setting-label {
  color: rgba(236, 243, 247, 0.92);
  margin-bottom: 8px;
}

.more-menu .setting-sub-label {
  color: #ffffff;
  margin-top: 10px;
  margin-bottom: 6px;
}

.more-menu .setting-note {
  color: rgba(236, 243, 247, 0.72);
}

.more-menu .setting-toggle {
  color: rgba(236, 243, 247, 0.9);
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-top: 4px;
}

.more-menu .setting-toggle + .setting-toggle {
  margin-top: 8px;
}

.more-menu .setting-toggle span {
  order: 1;
  flex: 1 1 auto;
  min-width: 0;
}

.more-menu .setting-toggle input[type="checkbox"] {
  order: 2;
  margin-top: 1px;
}

.more-menu .setting-toggle.setting-toggle-divider-top {
  margin-top: 12px;
  padding-top: 12px;
  display: flex;
  width: 100%;
  box-sizing: border-box;
  border-top: 1px solid rgba(236, 243, 247, 0.16);
}

.more-menu .setting-inline-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.more-menu .setting-inline-row.setting-inline-row-divider {
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(236, 243, 247, 0.16);
}

.more-menu .setting-inline-row.setting-inline-row-orientation {
  margin-top: 10px;
}

.more-menu .setting-inline-row .setting-label {
  margin: 0;
}

.more-menu .setting-select {
  width: 150px;
  min-height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(236, 243, 247, 0.34);
  background: rgba(16, 20, 24, 0.5);
  color: rgba(236, 243, 247, 0.94);
  padding: 5px 10px;
  font-size: 0.9rem;
}

.more-menu .setting-select.setting-select-wide {
  width: 100%;
  margin-top: 2px;
}

.more-menu .setting-select:focus {
  outline: 1px solid rgba(143, 216, 255, 0.9);
  outline-offset: 1px;
}

.more-menu .chip-btn {
  border-color: rgba(236, 243, 247, 0.3);
  background: transparent;
  color: rgba(236, 243, 247, 0.92);
}

.more-menu .chip-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(236, 243, 247, 0.4);
}

.more-menu .chip-btn.active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(236, 243, 247, 0.46);
  color: #ffffff;
  box-shadow: none;
}

.more-menu .orientation-toggle {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  width: 100%;
  border: 1px solid rgba(236, 243, 247, 0.34);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(16, 20, 24, 0.5);
}

.more-menu .orientation-toggle .chip-btn {
  flex: 1 1 50%;
  justify-content: center;
  border: 0;
  border-radius: 0;
  min-height: 30px;
  background: transparent;
}

.more-menu .orientation-toggle .chip-btn + .chip-btn {
  border-left: 1px solid rgba(236, 243, 247, 0.25);
}

.more-menu .orientation-toggle .chip-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.more-menu .orientation-toggle .chip-btn.active {
  background: #ffcc33;
  color: #101418;
}

.more-menu .orientation-toggle .chip-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.more-menu .orientation-toggle.orientation-toggle-inline {
  width: 164px;
  flex: 0 0 164px;
}

.more-menu .orientation-toggle.orientation-toggle-inline .chip-btn {
  min-height: 26px;
  padding: 3px 8px;
  font-size: 0.74rem;
  line-height: 1.1;
}

.more-links {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.more-text {
  margin: 0;
  font-size: 0.9rem;
  color: #42525f;
  line-height: 1.35;
}

.more-text a {
  color: #0e6688;
  text-decoration: none;
}

.more-text a:hover {
  text-decoration: underline;
}

.support-link-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: text-bottom;
  margin: 0 4px 0 2px;
}

.more-menu .more-links {
  border-top-color: rgba(236, 243, 247, 0.16);
}

.more-menu .more-text {
  color: rgba(236, 243, 247, 0.8);
}

.more-menu .more-text a {
  color: #8fd8ff;
}

.more-version {
  margin-top: 4px;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  opacity: 0.78;
}

.more-credit {
  margin-top: 4px;
  text-align: right;
}

.page-main {
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  z-index: 10;
}

.about-panel {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  z-index: 115;
  margin: 0;
  border: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
  background: #2f353a;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  max-height: calc(100vh - 60px);
  overflow: auto;
  animation: about-panel-drop 220ms ease-out;
}

@keyframes about-panel-drop {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.about-panel.is-closing {
  overflow: hidden;
  pointer-events: none;
  animation: about-panel-drop 280ms ease-in reverse forwards;
}

.about-panel-inner {
  max-width: none;
  margin: 0;
  padding: 0;
}

.about-panel h2 {
  margin: 0 0 4px;
  max-width: 1280px;
  font-family: "Roboto", "Avenir Next", "SF Pro Display", "Segoe UI Variable Display", "Helvetica Neue", sans-serif;
  font-size: clamp(2.5rem, 5.2vw, 5.8rem);
  line-height: 0.97;
  font-weight: 700;
  letter-spacing: -0.018em;
  color: #f5f9ff;
  text-wrap: balance;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

.hero-tilt-exclaim {
  display: inline-block;
  margin-left: 0.015em;
  transform: rotate(11deg) translateY(-0.01em);
  transform-origin: 68% 86%;
}

.hero-carousel {
  position: relative;
  border-radius: 0;
  border: 0;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    #2f353a 0,
    #000000 100px,
    #000000 100%
  );
  padding: 18px 24px 0;
  --hero-scene-index: 0;
  --hero-back-x: 0px;
  --hero-mid-x: 0px;
  --hero-front-x: 0px;
}

.hero-head {
  position: relative;
  z-index: 3;
  width: min(1240px, 100%);
  margin: 0 0 2px;
}

.hero-parallax {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  opacity: 1;
}

.hero-parallax-layer {
  position: absolute;
  inset: 0;
  background-repeat: repeat-x;
  background-size: auto 100%;
  transition: background-position 640ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: background-position;
  opacity: 1;
}

.hero-parallax-back {
  background-image: url("./assets/images/hero_background/hero_back.svg");
  background-position: var(--hero-back-x) 0;
}

.hero-parallax-mid {
  background-image: url("./assets/images/hero_background/hero_mid.svg");
  background-position: var(--hero-mid-x) center;
}

.hero-parallax-front {
  background-image: url("./assets/images/hero_background/hero_front.svg");
  background-position: var(--hero-front-x) 100%;
}

.hero-parallax-shade {
  display: none;
}

.hero-scenes-window {
  position: relative;
  z-index: 3;
  overflow: hidden;
  width: calc(100% + 48px);
  margin: 2px -24px 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  min-height: clamp(340px, 48vh, 432px);
}

.hero-scenes-track {
  display: flex;
  width: 100%;
  transform: translateX(calc(var(--hero-scene-index) * -100%));
  transition: transform 640ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.hero-carousel.no-anim .hero-scenes-track,
.hero-carousel.no-anim .hero-parallax-layer {
  transition: none !important;
}

.hero-scene {
  flex: 0 0 100%;
  max-width: 100%;
}

.hero-scene-content {
  width: 100%;
  min-height: clamp(340px, 48vh, 432px);
  padding: 12px 28px 14px;
  display: grid;
  grid-template-columns: minmax(240px, 37%) minmax(0, 1fr);
  gap: 34px;
  align-items: center;
}

.hero-scene-visual {
  margin: 0;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.1);
  background: rgba(14, 18, 24, 0.26);
}

.hero-scene-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-scene-media-slot {
  width: 100%;
  height: 100%;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.42);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.24));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.hero-scene-media-slot::before {
  content: attr(data-type);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: rgba(255, 204, 51, 0.95);
}

.hero-scene-media-slot span {
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(245, 249, 255, 0.93);
}

.hero-scene-copy {
  margin: 0;
  max-width: 700px;
  font-family: "Avenir Next", "SF Pro Text", "Segoe UI Variable Text", "Helvetica Neue", sans-serif;
  font-size: clamp(1.34rem, 2.55vw, 2.9rem);
  line-height: 1.16;
  font-weight: 600;
  letter-spacing: -0.006em;
  color: rgba(245, 249, 255, 0.98);
  text-wrap: balance;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}

.hero-scene-controls {
  position: relative;
  z-index: 3;
  margin: 6px auto 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 10px;
}

.hero-scene-arrow {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(17, 22, 29, 0.52);
  color: #f5f9ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.hero-scene-arrow img {
  display: block;
  filter: brightness(0) invert(1);
}

.hero-scene-arrow:hover {
  background: rgba(17, 22, 29, 0.7);
}

.hero-scene-arrow:focus-visible,
.hero-scene-dot:focus-visible {
  outline: 2px solid rgba(255, 204, 51, 0.9);
  outline-offset: 2px;
}

.hero-scene-dots {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.hero-scene-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.42);
  cursor: pointer;
}

.hero-scene-dot.is-active {
  background: #ffcc33;
}

@media (prefers-reduced-motion: reduce) {
  .about-panel,
  .about-panel.is-closing {
    animation: none !important;
  }
  .hero-scenes-track,
  .hero-parallax-layer {
    transition: none !important;
  }
}

@media (min-width: 901px) and (max-width: 1200px) {
  .hero-carousel {
    padding-top: 14px;
  }

  .about-panel h2 {
    display: block;
    margin-bottom: 0;
    font-size: clamp(3.25rem, 6.3vw, 4.2rem);
    line-height: 0.95;
    transform: none;
  }

  .hero-head {
    height: auto;
    overflow: visible;
    margin-bottom: 0;
  }

  .hero-scenes-window {
    margin-top: -8px;
    padding-top: 8px;
    min-height: 310px;
  }

  .hero-scene-content {
    min-height: 310px;
    padding: 6px 28px 12px;
    align-items: center;
  }
}

.about-actions {
  position: relative;
  z-index: 3;
  margin: 6px auto 0;
  display: flex;
  justify-content: center;
  padding: 0 0 8px;
}

.about-start-btn {
  min-height: 52px;
  padding: 0 32px;
  border-radius: 12px;
  border: 1px solid rgba(88, 211, 255, 0.95);
  background: linear-gradient(180deg, #1db1e8 0%, #0099cc 100%);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(0, 153, 204, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 120ms ease;
}

.about-start-btn:hover {
  background: linear-gradient(180deg, #2ec0f4 0%, #0ba6db 100%);
  border-color: rgba(128, 224, 255, 1);
  box-shadow: 0 18px 34px rgba(0, 153, 204, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.topbar-menu-btn:focus-visible,
.about-start-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.model-bar-row {
  width: 100%;
  margin-top: 0;
}

.imagestudio-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
}

.imagestudio-main.is-layers {
  grid-template-columns: auto minmax(0, 1fr) 210px;
}

.side-panel {
  position: relative;
  z-index: 40;
  align-self: start;
  display: flex;
  align-items: stretch;
  overflow: visible;
}

.sidebar {
  width: 285px;
  border-radius: 0;
  background: #2f353a;
  padding: 4px 10px 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 0;
  box-shadow: none;
  transition: width 200ms ease, padding 200ms ease;
}

.side-panel.is-collapsed .sidebar {
  width: 66px;
  padding: 8px 6px 2px;
}

.sidebar-collapse-row {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.sidebar-collapse-tab {
  z-index: 45;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  opacity: 0.92;
}

.sidebar-collapse-tab:hover {
  opacity: 1;
}

.sidebar-collapse-icon {
  width: 18px;
  height: 18px;
  display: none;
  filter: brightness(0) saturate(100%) invert(94%) sepia(7%) saturate(542%) hue-rotate(175deg) brightness(104%) contrast(98%);
}

.side-panel:not(.is-collapsed) .sidebar-open-icon {
  display: block;
}

.side-panel.is-collapsed .sidebar-collapsed-icon {
  display: block;
}

.side-panel.is-collapsed .sidebar-collapse-row {
  justify-content: flex-end;
}

.sidebar-collapse-tab:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

.menu-title,
.sidebar-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  line-height: 1;
}

.menu-title {
  margin: 0;
}

.sidebar-section-title {
  color: rgba(236, 243, 247, 0.86);
  margin-bottom: 6px;
}

#projectSectionTitle {
  display: block;
  width: 100%;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}

#projectSectionTitle[hidden] {
  display: none;
}

#projectSectionTitle:focus-visible {
  outline: 2px solid rgba(0, 153, 204, 0.55);
  outline-offset: 2px;
}

.sidebar-title-edit-input {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(236, 243, 247, 0.3);
  background: rgba(0, 0, 0, 0.3);
  color: rgba(236, 243, 247, 0.95);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0 7px;
}

.sidebar-title-edit-input:focus-visible {
  outline: 2px solid rgba(0, 153, 204, 0.55);
  outline-offset: 1px;
}

.controls-group { margin-bottom: 10px; }

.file-label-text { font-size: 0.9rem; margin-bottom: 4px; }

#editPanel[hidden],
#cutoutPanel[hidden],
#layersPanel[hidden],
#editorDropZone[hidden],
#cutoutWrap[hidden],
#layersWrap[hidden],
#modelBarCanvas[hidden] {
  display: none !important;
}

.sidebar-action-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 4px;
}

.sidebar-action-btn {
  width: 100%;
  min-height: 40px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  white-space: nowrap;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 6px 9px;
}

.sidebar-action-btn img {
  width: 16px;
  height: 16px;
  display: block;
  flex: 0 0 auto;
}

.sidebar-action-btn.secondary-btn {
  padding: 6px 9px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.sidebar-action-divider {
  height: 0;
  margin: 8px 0 6px;
  border-top: 1px solid rgba(236, 243, 247, 0.16);
}

.compact-image-actions {
  gap: 5px;
  margin-top: 2px;
}

.compact-image-divider {
  margin: 2px 0 1px;
}

.sidebar-compact-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.sidebar-compact-row .sidebar-action-btn {
  min-height: 32px;
  font-size: 0.82rem;
  padding: 5px 8px;
  gap: 6px;
}

.compact-image-actions .sidebar-compact-row .sidebar-action-btn.sidebar-option-btn {
  gap: 6px;
  padding: 5px 8px;
}

.sidebar-compact-file-btn {
  border-radius: 6px;
  padding: 5px 8px;
  min-height: 32px;
  font-size: 0.82rem;
}

.sidebar-export-divider {
  margin-top: 8px;
}

.quick-download-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  margin-top: 2px;
  margin-bottom: 2px;
}

.quick-download-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-height: 30px;
  color: rgba(236, 243, 247, 0.86);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding-right: 2px;
}

.quick-download-label img {
  width: 14px;
  height: 14px;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.quick-download-chip {
  min-height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(236, 243, 247, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(236, 243, 247, 0.92);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0 10px;
  cursor: pointer;
}

.quick-download-row .quick-download-chip:first-of-type {
  margin-left: auto;
}

.quick-download-chip:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(236, 243, 247, 0.4);
}

.quick-download-chip:disabled {
  opacity: 0.45;
  cursor: default;
}

.legacy-export-actions #downloadEditorBtn,
.legacy-export-actions #downloadEditorJpgBtn {
  display: none;
}

.legacy-export-actions {
  margin-top: 2px;
  gap: 4px;
}

.legacy-export-actions .sidebar-action-btn {
  min-height: 32px;
  font-size: 0.82rem;
  padding: 5px 8px;
  gap: 6px;
}

.legacy-export-actions .sidebar-action-btn.sidebar-option-btn {
  gap: 6px;
  padding: 5px 8px;
}

.side-panel .sidebar-option-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

.side-panel .sidebar-option-btn img {
  width: 14px;
  height: 14px;
  display: block;
  flex: 0 0 auto;
}

.sidebar-action-btn.sidebar-option-btn img {
  width: 16px;
  height: 16px;
}

.side-panel .sidebar-option-btn:focus-visible {
  outline: 2px solid rgba(0, 153, 204, 0.55);
  outline-offset: 2px;
}

/* Left menu options: minimal row look by default, highlighted only on hover/focus. */
.side-panel .sidebar-option-btn,
.side-panel .sidebar-option-btn.secondary-btn,
.side-panel .sidebar-option-btn.primary-btn,
.side-panel .sidebar-option-btn.file-button,
.side-panel .export-inline-actions .sidebar-option-btn.export-primary-btn,
.side-panel .adjustment-actions .sidebar-option-btn,
.side-panel .secondary-btn.full-width-btn.sidebar-option-btn,
.side-panel .primary-btn.full-width-btn.sidebar-option-btn {
  background: transparent;
  border-color: transparent;
  color: rgba(236, 243, 247, 0.92);
  box-shadow: none;
  justify-content: flex-start;
}

.side-panel .sidebar-option-btn img,
.side-panel .sidebar-option-btn.file-button img,
.side-panel .sidebar-option-btn.primary-btn img,
.side-panel .export-inline-actions .sidebar-option-btn.export-primary-btn img,
.side-panel .adjustment-actions .sidebar-option-btn img {
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.side-panel .sidebar-option-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(236, 243, 247, 0.26);
  box-shadow: none;
  transform: none;
}

.side-panel .adjustment-actions .sidebar-option-btn:hover:not(:disabled),
.side-panel .export-inline-actions .sidebar-option-btn:hover:not(:disabled),
.side-panel .sidebar-option-btn.file-button:hover:not(:disabled),
.side-panel .sidebar-option-btn.primary-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(236, 243, 247, 0.26);
}

.side-panel .sidebar-option-btn:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
}

.side-panel .sidebar-option-btn:disabled {
  background: transparent;
  border-color: transparent;
  color: rgba(236, 243, 247, 0.45);
  opacity: 1;
  box-shadow: none;
}

.side-panel .sidebar-option-btn:disabled img {
  opacity: 0.45;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid #0099cc;
  background: #0099cc;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.82rem;
  min-width: 0;
}

.file-button input[type="file"] { display: none; }
.file-button:hover {
  background: #0089b8;
  border-color: #0089b8;
}

.file-button:disabled {
  background: #0099cc;
  border-color: #0099cc;
  color: #ffffff;
  opacity: 0.75;
  cursor: default;
}

.file-button img {
  filter: brightness(0) invert(1);
}

.file-name { font-size: 0.9rem; color: rgba(236, 243, 247, 0.72); margin-top: 4px; padding-bottom: 4px; }
.hint { font-size: 0.8rem; color: rgba(236, 243, 247, 0.65); }

.sidebar-quick-actions {
  display: none;
  margin-top: 8px;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.quick-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 0;
  border: 1px solid transparent;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.quick-action-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(236, 243, 247, 0.26);
}

.quick-action-btn img {
  width: 18px;
  height: 18px;
  display: block;
  filter: brightness(0) saturate(100%) invert(94%) sepia(7%) saturate(542%) hue-rotate(175deg) brightness(104%) contrast(98%);
}

.quick-action-btn.is-loading img {
  animation: spin 0.9s linear infinite;
}

.quick-action-btn:disabled {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.quick-action-btn:disabled img {
  opacity: 0.45;
}

.quick-action-btn.is-loading:disabled img {
  opacity: 1;
}

.quick-action-wide {
  width: 38px;
}

.quick-separator {
  width: 1px;
  height: 22px;
  background: rgba(0, 0, 0, 0.2);
}

.setting-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: #334451;
  margin-bottom: 6px;
}

.setting-sub-label {
  margin-top: 6px;
  margin-bottom: 4px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #5b6a74;
}

.setting-note {
  margin-top: 6px;
  font-size: 0.84rem;
  line-height: 1.35;
  color: #5b6a74;
}

.setting-toggle {
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.94rem;
  color: #334451;
  cursor: pointer;
  user-select: none;
}

.setting-toggle span {
  line-height: 1.2;
}

.setting-toggle input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 19px;
  min-width: 32px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 204, 51, 0.42);
  background: rgba(255, 204, 51, 0.22);
  position: relative;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
}

.setting-toggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #f5f9ff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 180ms ease, background 180ms ease;
}

.setting-toggle input[type="checkbox"]:checked {
  background: #ffcc33;
  border-color: #ffcc33;
}

.setting-toggle input[type="checkbox"]:checked::after {
  transform: translateX(13px);
  background: #ffffff;
}

.setting-toggle input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(143, 216, 255, 0.95);
  outline-offset: 2px;
}

.setting-toggle input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: default;
}

.side-panel.is-collapsed .sidebar-action-list,
.side-panel.is-collapsed .file-name,
.side-panel.is-collapsed .handoff-row,
.side-panel.is-collapsed .export-inline-wrap,
.side-panel.is-collapsed .menu-title-bar.sidebar-title-bar,
.side-panel.is-collapsed #layersPanel,
.side-panel.is-collapsed #editPanel,
.side-panel.is-collapsed #cutoutPanel {
  display: none !important;
}

.side-panel.is-collapsed .sidebar-export-divider,
.side-panel.is-collapsed .quick-download-row,
.side-panel.is-collapsed #btnQuickDownload {
  display: none !important;
}

.side-panel.is-collapsed .sidebar-section-title {
  display: none;
}

.side-panel.is-collapsed .sidebar-quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 0;
}

.side-panel.is-collapsed .quick-separator {
  width: 24px;
  height: 1px;
}

.export-inline-wrap {
  margin-top: 4px;
  display: block;
}

.export-inline-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.export-inline-btn {
  padding: 7px 10px;
  font-size: 0.78rem;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.export-primary-btn {
  width: 100%;
  background: #0099cc;
  color: #ffffff;
  border-color: #0099cc;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.export-primary-btn:hover:not(:disabled) {
  background: #00a6dd;
  border-color: #00a6dd;
}

.export-primary-btn:not(:disabled) {
  color: #ffffff;
}

.export-primary-btn:disabled {
  opacity: 0.75;
  background: #0099cc;
  border-color: #0099cc;
  color: #ffffff;
}

.export-primary-btn img {
  filter: brightness(0) invert(1);
}

.export-arrow {
  width: 14px;
  height: 14px;
  display: block;
  filter: brightness(0) invert(1);
  flex: 0 0 auto;
}

.export-arrow-left {
  transform: scaleX(-1);
}

.export-inline-btn[hidden] {
  display: none !important;
}

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

.chip-btn {
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #f4fbff;
  color: #1a1a1a;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease, border-color 0.15s ease;
}

.chip-btn:hover { background: #e2f3ff; }

.chip-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

#orientationChips .chip-btn:disabled {
  opacity: 0.45;
  color: #8495a3;
  background: #eef2f5;
  border-color: #c9d3db;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

#orientationChips .chip-btn.active:disabled {
  background: #9fb6c6;
  border-color: #9fb6c6;
  color: #f4f8fb;
}

.style-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}
.style-dot.bw { background: #9a9a9a; }
.style-dot.sepia { background: #ffcc33; }
.style-dot.postal { background: #f5054f; }

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.adjustment-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
}
.adjustment-actions .secondary-btn {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
  min-width: 0;
  padding: 7px 8px;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}
.adjustment-actions .secondary-btn:hover:not(:disabled) {
  background: #1ba8d8;
  border-color: #1ba8d8;
}
.adjustment-actions #fillBtn,
.adjustment-actions #resetEditBtn,
.adjustment-actions #btnResetCutout {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
}
.primary-transfer-row .secondary-btn {
  flex: 1 1 0;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 8px;
}
.primary-transfer-row #sendToLayersBtn {
  flex: 1 1 0;
}
.primary-transfer-row {
  margin-top: 10px;
}
.handoff-row {
  margin-top: 8px;
}
.handoff-row .secondary-btn {
  width: 100%;
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.handoff-row .secondary-btn:hover:not(:disabled) {
  background: #1ba8d8;
  border-color: #1ba8d8;
}
.handoff-row .secondary-btn img {
  width: 14px;
  height: 14px;
  filter: brightness(0) invert(1);
}

.parallax-title-bar {
  margin-bottom: 0;
}

.parallax-title-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(236, 243, 247, 0.96);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.parallax-title-icon {
  width: 14px;
  height: 14px;
  display: block;
  filter: brightness(0) invert(1);
}

.parallax-panel {
  overflow: visible;
  margin-top: 10px;
}

.parallax-controls {
  display: grid;
  gap: 12px;
}

.parallax-controls .parallax-slider-row > span {
  font-size: 0.96rem;
  font-weight: 600;
  color: rgba(236, 243, 247, 0.9);
}

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

.parallax-controls .parallax-slider-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.parallax-controls .parallax-slider-inline span {
  font-size: 0.92rem;
  color: rgba(236, 243, 247, 0.8);
  min-width: 40px;
  text-align: right;
}

.parallax-controls .parallax-slider-inline input[type="range"] {
  accent-color: var(--ui-slider-accent) !important;
  height: 14px;
}

.parallax-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: 0.94rem;
  line-height: 1.25;
  color: rgba(236, 243, 247, 0.9);
}

.parallax-row > span {
  font-weight: 600;
}

.parallax-row select {
  min-width: 150px;
  min-height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(236, 243, 247, 0.34);
  background: rgba(16, 20, 24, 0.5);
  color: rgba(236, 243, 247, 0.94);
  padding: 5px 10px;
  font-size: 0.9rem;
}

.parallax-row select:focus {
  outline: 1px solid rgba(143, 216, 255, 0.9);
  outline-offset: 1px;
}

.parallax-row.parallax-row-switch {
  grid-template-columns: 1fr auto;
}

.parallax-row.parallax-row-switch input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 19px;
  min-width: 32px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 204, 51, 0.42);
  background: rgba(255, 204, 51, 0.22);
  position: relative;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
}

.parallax-row.parallax-row-switch input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #f5f9ff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 180ms ease, background 180ms ease;
}

.parallax-row.parallax-row-switch input[type="checkbox"]:checked {
  background: #ffcc33;
  border-color: #ffcc33;
}

.parallax-row.parallax-row-switch input[type="checkbox"]:checked::after {
  transform: translateX(13px);
  background: #ffffff;
}

.parallax-row.parallax-row-switch input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(143, 216, 255, 0.95);
  outline-offset: 2px;
}

.side-panel #btnExportParallaxGif {
  width: 100%;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid #0099cc;
  background: #0099cc;
  --parallax-export-progress: 0%;
  color: #ffffff;
  padding: 9px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  position: relative;
  overflow: hidden;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  box-shadow: none;
}

.side-panel #btnExportParallaxGif > * {
  position: relative;
  z-index: 1;
}

.side-panel #btnExportParallaxGif.is-progress {
  background: #616b75;
  border-color: #616b75;
}

.side-panel #btnExportParallaxGif.is-progress::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--parallax-export-progress);
  background: #0099cc;
  transition: width 180ms linear;
  z-index: 0;
}

.side-panel #btnExportParallaxGif img {
  width: 14px;
  height: 14px;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.side-panel #btnExportParallaxGif:hover:not(:disabled) {
  background: #00a6dd;
  border-color: #00a6dd;
}

.side-panel #btnExportParallaxGif:disabled:not(.is-progress) {
  background: #0099cc;
  border-color: #0099cc;
  color: #ffffff;
  opacity: 1;
  cursor: default;
}

.side-panel #btnExportParallaxGif.is-progress:disabled {
  background: #616b75;
  border-color: #616b75;
  color: #ffffff;
  opacity: 1;
  cursor: default;
}

.side-panel #btnExportParallaxGif:disabled img {
  opacity: 0.9;
}

.adjustment-actions .secondary-btn img {
  width: 14px;
  height: 14px;
  filter: brightness(0) invert(1);
}

.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(12, 18, 27, 0.62);
  display: grid;
  place-items: center;
  padding: 20px;
}

.preview-overlay[hidden] {
  display: none !important;
}

.preview-modal {
  width: min(92vw, 980px);
  max-height: 92vh;
  background: #2f353a;
  border-radius: 0;
  border: 1px solid rgba(236, 243, 247, 0.16);
  box-shadow: none;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.preview-head {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(236, 243, 247, 0.16);
  background: rgba(0, 0, 0, 0.22);
}

.preview-head h3 {
  margin: 0;
  font-size: 1rem;
  color: rgba(236, 243, 247, 0.92);
}

.preview-body {
  padding: 12px;
  display: grid;
  place-items: center;
  background: #1f262d;
  min-height: 200px;
}

#parallaxPreviewImage {
  max-width: 100%;
  max-height: 66vh;
  border-radius: 8px;
  border: 1px solid rgba(236, 243, 247, 0.18);
  background: #101418;
}

.preview-actions {
  padding: 12px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid rgba(236, 243, 247, 0.16);
  background: #2f353a;
}

.preview-actions .secondary-btn {
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(236, 243, 247, 0.24);
  background: #3B434A;
  color: rgba(236, 243, 247, 0.94);
  font-weight: 600;
}

.preview-actions .secondary-btn:hover:not(:disabled) {
  background: #4D545B;
  border-color: rgba(236, 243, 247, 0.32);
}

.preview-actions .secondary-btn:focus-visible {
  outline: 2px solid rgba(143, 216, 255, 0.78);
  outline-offset: 1px;
}

.preview-actions #btnSaveParallaxGif {
  background: #0099cc;
  border-color: #0099cc;
  color: #ffffff;
}

.preview-actions #btnSaveParallaxGif:hover:not(:disabled) {
  background: #00a6dd;
  border-color: #00a6dd;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 21000;
  background: rgba(12, 18, 27, 0.62);
  display: grid;
  place-items: center;
  padding: 20px;
}

.confirm-overlay[hidden] {
  display: none !important;
}

.confirm-modal {
  width: min(92vw, 440px);
  background: #2f353a;
  border-radius: 0;
  border: 1px solid rgba(236, 243, 247, 0.16);
  box-shadow: none;
  overflow: hidden;
}

.confirm-title-bar {
  margin: 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(236, 243, 247, 0.16);
}

.confirm-title-bar .menu-title {
  color: rgba(236, 243, 247, 0.92);
}

.confirm-body {
  padding: 12px;
}

.confirm-body p {
  margin: 0;
  color: rgba(236, 243, 247, 0.84);
  line-height: 1.45;
  white-space: pre-line;
}

.confirm-options {
  margin: 0;
}

.confirm-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: rgba(236, 243, 247, 0.84);
  user-select: none;
  cursor: pointer;
}

.confirm-checkbox-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #0099cc;
}

.confirm-actions {
  padding: 8px 12px 12px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(236, 243, 247, 0.14);
  background: transparent;
}

.confirm-actions-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.confirm-modal .secondary-btn {
  border: 1px solid rgba(236, 243, 247, 0.34);
  background: transparent;
  color: rgba(236, 243, 247, 0.92);
}

.confirm-modal .secondary-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.confirm-modal .confirm-accept-btn {
  background: #0099cc;
  border-color: #0099cc;
  color: #ffffff;
}

.confirm-modal .confirm-accept-btn:hover:not(:disabled) {
  background: #00a6dd;
  border-color: #00a6dd;
}

.support-modal {
  width: min(92vw, 520px);
}

.support-body p {
  margin: 0;
}

.support-link-row {
  margin-top: 12px !important;
  color: rgba(236, 243, 247, 0.84);
}

.support-link-row .support-link-icon {
  width: 18px;
  height: 18px;
  margin-right: 6px;
}

.support-link-row a {
  color: #8fd8ff;
  text-decoration: underline;
}

.support-link-row a:hover {
  color: #b5e7ff;
}

.support-dismiss-text {
  border: 0;
  background: transparent;
  color: rgba(236, 243, 247, 0.72);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

.support-dismiss-text:hover {
  color: rgba(236, 243, 247, 0.96);
  text-decoration: underline;
}

.slider-group label { font-size: 0.9rem; }
.slider-row { display: flex; align-items: center; gap: 8px; }
.slider-row span { min-width: 3ch; text-align: right; font-size: 0.85rem; }
input[type="range"] { flex: 1; accent-color: var(--ui-slider-accent); }

button { font: inherit; }

button.main {
  background: var(--blue);
  border: none;
  border-radius: 12px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.2);
  transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
button.main:hover:not(:disabled) { background: #1ba8d8; transform: translateY(-1px); }
button.main:disabled { opacity: 0.4; cursor: default; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); }
button.main img { filter: brightness(0) invert(1); }

.secondary-btn {
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #f4fbff;
  color: #1a1a1a;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.82rem;
}
.secondary-btn:hover:not(:disabled) { background: #e2f3ff; }
.secondary-btn:disabled { opacity: 0.45; cursor: default; }

/* Force Retro import/export buttons to keep primary blue in all states. */
.export-inline-actions .export-primary-btn,
.export-inline-actions .export-primary-btn:not(:disabled),
.export-inline-actions .export-primary-btn:disabled {
  background: #0099cc;
  border-color: #0099cc;
  color: #ffffff;
  opacity: 1;
}

.export-inline-actions .export-primary-btn:hover:not(:disabled) {
  background: #00a6dd;
  border-color: #00a6dd;
}
.secondary-btn.full-width-btn {
  width: 100%;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.secondary-btn.full-width-btn.sidebar-option-btn,
.primary-btn.full-width-btn.sidebar-option-btn {
  justify-content: flex-start;
}
.chroma-btn {
  background: #f4fbff;
  color: #0e6688;
  border-color: rgba(0, 153, 204, 0.35);
  font-weight: 700;
}
.chroma-btn:hover:not(:disabled) {
  background: #dff4ff;
}

.primary-btn {
  border-radius: 12px;
  border: none;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  background: #0099cc;
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}
.primary-btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.primary-btn.is-loading { pointer-events: none; }
.primary-btn img {
  filter: brightness(0) invert(1);
}
.primary-btn .spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: spin 0.9s linear infinite;
}
.full-width-btn { width: 100%; justify-content: center; display: inline-flex; }

/* Mode tabs */
.mode-tabs {
  display: inline-flex;
  border-radius: 12px;
  background: #f4f4f4;
  padding: 2px;
  margin-bottom: 14px;
  width: 100%;
}
.mode-tabs .mode-tab[data-mode="cutout"] {
  display: none !important;
}
.mode-tab {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
  background: transparent;
  color: #555;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.mode-tab.active {
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}
.mode-tab.active img { filter: brightness(0) invert(1); }

.mode-tab img {
  width: 16px;
  height: 16px;
}
.mode-tab .bgone-tab-icon {
  width: 28px;
  height: 28px;
}
.mode-tab[data-mode="layers"] img {
  width: 18px;
  height: 18px;
}

.app-brand-icon {
  color: #fc3;
}
.app-brand-glyph {
  width: 24px;
  height: 24px;
  display: block;
  background: #fc3;
  mask-image: url("./svg/pic_ai_line_yellow.svg");
  -webkit-mask-image: url("./svg/pic_ai_line_yellow.svg");
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  mask-size: contain;
  -webkit-mask-size: contain;
}

/* Canvas area */
.canvas-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  justify-content: flex-start;
  position: relative;
  min-width: 0;
}

.layers-right-rail {
  display: none;
  width: 210px;
  min-width: 210px;
}

.canvas-area.is-layers {
  padding-top: 18px;
  padding-bottom: 18px;
  padding-left: 18px;
  padding-right: 18px;
}

.imagestudio-main.is-layers .layers-right-rail {
  display: flex;
  position: relative;
  min-height: 0;
}

#modelBarCanvas {
  display: flex;
}

.canvas-stack {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
}

.canvas-stack.is-layers {
  justify-content: center;
}

.canvas-stack.is-layers #layersWrap {
  width: auto;
}

/* Hard-gate canvas visibility by active mode */
.canvas-stack.is-edit #cutoutWrap {
  display: none !important;
}

.canvas-stack.is-cutout #editorDropZone {
  display: none !important;
}

.canvas-stack.is-edit #layersWrap,
.canvas-stack.is-cutout #layersWrap {
  display: none !important;
}

.canvas-stack.is-layers #editorDropZone,
.canvas-stack.is-layers #cutoutWrap {
  display: none !important;
}

.canvas-drop-zone {
  position: relative;
  width: 100%;
  max-width: 780px;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #e7f7fc;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.canvas-drop-zone canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}

.drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: 1.6rem;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.canvas-drop-zone.dragover .drop-hint { opacity: 1; }

/* Cutout canvas (from BGone) */
.canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 780px;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
  padding: 14px;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.12);
}

#cutoutWrap {
  overflow: auto;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  touch-action: none;
}

#cutoutWrap[data-bg="checker"]::before {
  display: block;
}

#cutoutWrap[data-bg="white"]::before,
#cutoutWrap[data-bg="black"]::before {
  display: none;
}

#cutoutWrap[data-bg="white"] {
  background: #ffffff;
}

#cutoutWrap[data-bg="black"] {
  background: #101418;
}

.canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 8px;
  background-image:
    linear-gradient(45deg, #d8d9de 25%, transparent 25%, transparent 75%, #d8d9de 75%, #d8d9de),
    linear-gradient(45deg, #d8d9de 25%, transparent 25%, transparent 75%, #d8d9de 75%, #d8d9de);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

#cutoutCanvas {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  flex: 0 0 auto;
  image-rendering: smooth;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.cutout-view-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.cutout-bg-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 0;
}

.cutout-bg-switch-inline {
  margin-left: auto;
}

.cutout-bg-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.24);
  cursor: pointer;
  padding: 0;
}

.cutout-bg-btn[data-cutout-bg="checker"] {
  background-image:
    linear-gradient(45deg, #d8d9de 25%, transparent 25%, transparent 75%, #d8d9de 75%, #d8d9de),
    linear-gradient(45deg, #d8d9de 25%, transparent 25%, transparent 75%, #d8d9de 75%, #d8d9de);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
  background-color: #f8f9fb;
}

.cutout-bg-btn[data-cutout-bg="white"] {
  background: #ffffff;
}

.cutout-bg-btn[data-cutout-bg="black"] {
  background: #131920;
}

.cutout-bg-context-btn {
  width: auto;
  min-width: 30px;
  padding: 0 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #223140;
  background: #f3f7fb;
}

.cutout-bg-btn.active {
  outline: 2px solid #ff9900;
  outline-offset: 1px;
}

.overlay-msg {
  z-index: 2;
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.8rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.brush-preview {
  position: absolute;
  z-index: 3;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 153, 204, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 153, 204, 0.9);
  background: rgba(0, 0, 0, 0.1);
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: none;
  mix-blend-mode: screen;
}

.brush-preview.restore {
  border-color: rgba(255, 204, 51, 0.95);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9), 0 0 12px rgba(255, 204, 51, 0.9);
}

/* Model bar (compact) */
.model-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: #fff7e0;
  font-size: 0.82rem;
  margin-top: 12px;
  max-width: none;
  flex: 1 1 auto;
  min-width: 320px;
}

.model-bar-row #modelBarCanvas {
  margin-left: 0;
}
.model-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #c47a00;
}
.model-note-text { flex: 1 1 auto; }
.model-note-text.is-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.model-note-text.is-loading::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(0, 153, 204, 0.25);
  border-top-color: #0099cc;
  animation: spin 0.9s linear infinite;
}
.model-btn {
  border: none;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  background: #ffffff;
  color: #444;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.model-btn:hover { background: #f3f3f3; }
.model-dot { width: 8px; height: 8px; border-radius: 50%; background: #bbb; }
.model-dot.ok {
  background: #2ecc71;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 10px rgba(46, 204, 113, 0.9);
}

.arrow-left-btn img {
  transform: rotate(180deg);
}

#brushSize {
  width: 100%;
  display: block;
}

#aiStrength {
  width: 100%;
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Brush controls (from BGone) */
.brush-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  margin: 6px 0 2px;
}
.ai-strength-row {
  margin-top: 10px;
}
.brush-value { font-weight: 600; }

.pill-toggle {
  display: inline-flex;
  border-radius: 12px;
  background: #f4f4f4;
  padding: 2px;
  margin-top: 8px;
}
.pill-toggle button {
  border: none;
  border-radius: 10px;
  padding: 5px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  background: transparent;
  color: #555;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.pill-toggle button img {
  width: 14px;
  height: 14px;
  display: block;
}

.pill-toggle button:hover:not(:disabled):not(.active) {
  background: rgba(0, 153, 204, 0.12);
}

.layer-bg-edit-toggle button,
.layer-bg-brush-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.layer-bg-edit-toggle button img,
.layer-bg-brush-toggle button img {
  width: 14px;
  height: 14px;
  display: block;
}

.layer-bg-edit-toggle button.active img,
.layer-bg-brush-toggle button.active img {
  filter: brightness(0) invert(1);
}
.pill-toggle button.active {
  background: #0099cc;
  color: #ffffff;
  font-weight: 600;
}

.pill-toggle button.active img {
  filter: brightness(0) invert(1);
}

.undo-redo-row {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.layers-wrap {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: visible;
}

.layers-canvas-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 4 / 3;
  box-sizing: border-box;
  border-radius: 14px;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.layers-canvas-wrap.dragover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.16), 0 0 0 2px rgba(0, 153, 204, 0.55);
}

.layers-canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image:
    linear-gradient(45deg, #d8d9de 25%, transparent 25%, transparent 75%, #d8d9de 75%, #d8d9de),
    linear-gradient(45deg, #d8d9de 25%, transparent 25%, transparent 75%, #d8d9de 75%, #d8d9de);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

#layersCanvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#layersCanvas:active {
  cursor: grabbing;
}

.layers-empty-state {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  display: grid;
  place-items: stretch;
  padding: 0;
  pointer-events: none;
}

.layers-empty-onboarding {
  width: 100%;
  height: 100%;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layers-empty-carousel {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  border-radius: inherit;
  border: 0;
  background: #111821;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 10px 24px rgba(0, 0, 0, 0.24);
  --hero-scene-index: 0;
}

.layers-empty-state.is-flat-canvas .layers-empty-carousel {
  background:
    linear-gradient(
      140deg,
      #ffcc33 0%,
      #AF29A4 58%,
      #0099cc 100%
    );
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 -26px 56px rgba(0, 0, 0, 0.16);
}

.layers-empty-state.is-flat-canvas .layers-empty-carousel::after {
  content: "Insert image to start";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: min(84%, 360px);
  text-align: center;
  font-size: clamp(1rem, 1.9vw, 1.35rem);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #ffffff;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
}

.layers-empty-state.is-flat-canvas .layers-empty-scenes-window,
.layers-empty-state.is-flat-canvas .layers-empty-scene-arrow,
.layers-empty-state.is-flat-canvas .layers-empty-start-btn {
  display: none;
}

.layers-empty-state.is-flat-canvas .layers-empty-onboarding {
  pointer-events: none;
}

.layers-empty-scenes-window {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.layers-empty-scenes-track {
  display: flex;
  width: 100%;
  height: 100%;
  transform: translateX(calc(var(--hero-scene-index) * -100%));
  transition: transform 640ms cubic-bezier(0.22, 1, 0.36, 1);
}

.layers-empty-carousel.no-anim .layers-empty-scenes-track {
  transition: none !important;
}

.layers-empty-scene {
  flex: 0 0 100%;
  max-width: 100%;
}

.layers-empty-scene-content {
  position: relative;
  width: 100%;
  height: 100%;
}

.layers-empty-scene-visual {
  position: absolute;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  border: 0;
  box-shadow: none;
  background: #111821;
}

.layers-empty-scene-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.layers-empty-scene-copy {
  position: absolute;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  width: min(88%, 600px);
  text-align: center;
  font-size: clamp(1.05rem, 2.15vw, 1.7rem);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  text-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}

.layers-empty-scenes-track .layers-empty-scene:nth-child(4) .layers-empty-scene-copy {
  color: #FFCC33;
}

.layers-empty-scene-content::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(7, 11, 16, 0) 50%, rgba(7, 11, 16, 0.58) 88%, rgba(7, 11, 16, 0.72) 100%);
  pointer-events: none;
}

.layers-empty-scene-controls {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 0;
}

.layers-empty-scene-arrow {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(17, 22, 29, 0.52);
  color: #f5f9ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.layers-empty-scene-arrow img {
  display: block;
  filter: brightness(0) invert(1);
}

.layers-empty-scene-arrow:hover {
  background: rgba(17, 22, 29, 0.7);
}

.layers-empty-scene-arrow.layers-empty-scene-arrow-edge {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 30px;
  height: 54px;
  border-radius: 10px;
  background: rgba(17, 22, 29, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.layers-empty-scene-arrow.layers-empty-scene-arrow-edge.is-prev {
  left: 8px;
}

.layers-empty-scene-arrow.layers-empty-scene-arrow-edge.is-next {
  right: 8px;
}

.layers-empty-scene-dots {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.layers-empty-scene-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.42);
  cursor: pointer;
}

.layers-empty-scene-dot.is-active {
  background: #ffcc33;
}

.layers-empty-scene-dot:focus-visible,
.layers-empty-scene-arrow:focus-visible,
.layers-empty-start-btn:focus-visible {
  outline: 2px solid rgba(255, 204, 51, 0.9);
  outline-offset: 2px;
}

.layers-empty-start-btn {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 6;
  min-height: 42px;
  padding: 0 14px 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  border: 0;
  background: #0099cc;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
  transition: background 150ms ease, box-shadow 150ms ease;
}

.layers-empty-start-btn:hover {
  background: #0ba6db;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.3);
}

.layers-empty-start-btn img {
  width: 16px;
  height: 16px;
  display: block;
  filter: brightness(0) saturate(100%) invert(100%);
  opacity: 0.95;
}

.layers-list-panel {
  position: relative;
  z-index: 120;
  border-radius: 0;
  background: #2f353a;
  border: 0;
  padding: 10px;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.layers-right-rail {
  position: relative;
  z-index: 260;
  background: #2f353a;
  padding: 0 6px 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
  overflow: visible;
}

.layers-right-rail::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 54px;
  width: 34px;
  height: 34px;
  transform: translateX(-50%);
  background-color: #24292d;
  -webkit-mask: url("./assets/svg/blizlab-bolt.svg") no-repeat center / contain;
  mask: url("./assets/svg/blizlab-bolt.svg") no-repeat center / contain;
  opacity: 0.95;
  pointer-events: none;
  z-index: 0;
}

.layers-right-rail .layers-panel-head,
.layers-right-rail .layers-list,
.layers-right-rail .layers-panel-foot {
  position: relative;
  z-index: 1;
}

.layers-right-rail .layers-panel-head {
  z-index: 3;
  margin: 0 -6px 6px;
  min-height: 34px;
  padding: 0 6px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(236, 243, 247, 0.16);
}

.layers-right-rail .layers-panel-head .sidebar-section-title {
  color: rgba(236, 243, 247, 0.92);
}

.layers-right-rail .layers-count {
  color: rgba(236, 243, 247, 0.6);
}

.layers-right-rail .layers-head-btn,
.layers-right-rail .layers-menu-btn,
.layers-right-rail .layers-add-btn,
.layers-right-rail .layers-add-bottom-btn {
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(236, 243, 247, 0.92);
}

.layers-right-rail .layers-head-actions {
  gap: 0;
  padding-right: 5px;
}

.layers-right-rail .layers-head-btn,
.layers-right-rail .layers-menu-btn,
.layers-right-rail .layers-add-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
}

.layers-right-rail .layers-head-btn:hover,
.layers-right-rail .layers-menu-btn:hover,
.layers-right-rail .layers-add-btn:hover,
.layers-right-rail .layers-add-bottom-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(236, 243, 247, 0.26);
}

.layers-right-rail .layers-head-btn:disabled,
.layers-right-rail .layers-menu-btn:disabled,
.layers-right-rail .layers-add-btn:disabled,
.layers-right-rail .layers-add-bottom-btn:disabled {
  color: rgba(236, 243, 247, 0.45);
  opacity: 1;
}

.layers-right-rail .layers-head-btn img,
.layers-right-rail .layers-add-btn img {
  width: 18px;
  height: 18px;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.layers-right-rail .layers-menu-icon {
  width: 18px;
  height: 18px;
}

.layers-right-rail .layers-head-btn:disabled img,
.layers-right-rail .layers-add-btn:disabled img {
  opacity: 0.45;
}

.layers-right-rail .layers-head-btn.is-active,
.layers-right-rail .layers-menu-btn.is-active {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(236, 243, 247, 0.32);
  color: #ffffff;
}

.layers-panel-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 6px;
}

.layers-panel-head.is-menu-open {
  z-index: 50;
}

.layers-head-title {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
}

.layers-panel-head .sidebar-section-title {
  margin-bottom: 0;
}

.layers-count {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #7f8d97;
}

.layers-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.layers-head-btn,
.layers-menu-btn,
.layers-add-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #f4fbff;
  color: #0e6688;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.layers-add-btn img {
  width: 16px;
  height: 16px;
  display: block;
}

.layers-menu-btn {
  --layers-menu-icon-color: #0e6688;
}

.layers-head-btn {
  width: 30px;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.layers-head-btn:hover,
.layers-menu-btn:hover,
.layers-add-btn:hover {
  background: #e2f3ff;
}

.layers-head-btn:disabled,
.layers-menu-btn:disabled,
.layers-add-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.layers-head-btn.is-active,
.layers-menu-btn.is-active {
  background: #0e6688;
  color: #ffffff;
  border-color: #0e6688;
}

.layers-menu-icon {
  width: 16px;
  height: 16px;
  display: block;
  background-color: var(--layers-menu-icon-color);
  -webkit-mask: url("./svg/palette_fill.svg") no-repeat center / contain;
  mask: url("./svg/palette_fill.svg") no-repeat center / contain;
  filter: drop-shadow(0 0 0.4px rgba(0, 0, 0, 0.38));
}

.layers-menu-btn.is-active:not([data-has-bg="true"]) .layers-menu-icon {
  background-color: #ffffff;
}

.layers-right-rail .layers-menu-btn {
  --layers-menu-icon-color: rgba(236, 243, 247, 0.92);
}

.layers-head-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 232px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: #f9fcff;
  color: #12202a;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.24);
  padding: 10px;
  z-index: 60;
}

.layers-right-rail .layers-head-menu {
  border-color: rgba(236, 243, 247, 0.22);
  background: #2b333b;
  color: rgba(236, 243, 247, 0.95);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.42);
}

.layers-head-menu .menu-title-bar.layers-head-menu-title-bar {
  margin: -10px -10px 10px;
  min-height: 34px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(236, 243, 247, 0.16);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.layers-head-menu .menu-title-bar.layers-head-menu-title-bar .sidebar-section-title {
  margin-bottom: 0;
  color: rgba(236, 243, 247, 0.92);
}

.menu-title-close,
.layers-head-menu-close {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.menu-title-close:hover,
.layers-head-menu-close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(236, 243, 247, 0.26);
}

.menu-title-close:disabled,
.layers-head-menu-close:disabled {
  opacity: 0.48;
  cursor: default;
}

.menu-title-close:disabled:hover,
.layers-head-menu-close:disabled:hover {
  background: transparent;
  border-color: transparent;
}

.menu-title-close img,
.layers-head-menu-close img {
  width: 18px;
  height: 18px;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.layers-bg-row {
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  margin-bottom: 8px;
}

.layers-bg-row-hex {
  margin-bottom: 10px;
}

.layers-bg-row input[type="color"] {
  width: 100%;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #ffffff;
  padding: 1px;
  cursor: pointer;
}

.layers-bg-row input[type="text"] {
  width: 100%;
  min-width: 0;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #ffffff;
  color: #1c2d38;
  padding: 0 8px;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
}

@media (max-width: 900px) and (pointer: coarse) {
  #layersBgHexInput {
    font-size: 16px;
  }
}

.layers-bg-row input[type="text"]:focus,
.layers-bg-row input[type="color"]:focus {
  outline: 2px solid rgba(0, 153, 204, 0.35);
  outline-offset: 1px;
}

.layers-right-rail .layers-bg-row input[type="color"],
.layers-right-rail .layers-bg-row input[type="text"] {
  border-color: rgba(236, 243, 247, 0.26);
  background: #222b33;
  color: rgba(236, 243, 247, 0.95);
}

.layers-bg-color-controls {
  margin-bottom: 10px;
}

.layers-bg-color-controls .layer-text-color-presets {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.layers-bg-color-controls .layer-text-color-preset {
  width: 100%;
  height: 24px;
  border-radius: 3px;
}

.layers-bg-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.layers-bg-action-btn {
  min-height: 30px;
  font-size: 0.74rem;
  line-height: 1;
  border-radius: 8px;
}

.layers-bg-actions .secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(236, 243, 247, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(236, 243, 247, 0.96);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.layers-bg-actions .layers-bg-action-btn-full {
  grid-column: 1 / -1;
}

.layers-bg-actions .secondary-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(236, 243, 247, 0.36);
}

.layers-bg-actions .secondary-btn:disabled {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(236, 243, 247, 0.14);
  color: rgba(236, 243, 247, 0.44);
}

.layers-bg-menu-note {
  font-size: 0.69rem;
  line-height: 1.35;
  color: #5d6b76;
}

.layers-right-rail .layers-bg-menu-note {
  color: rgba(236, 243, 247, 0.66);
}

.layers-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.layers-panel-foot {
  margin-top: 8px;
}

.layers-add-bottom-btn {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #f4fbff;
  color: #0e6688;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  padding: 7px 10px;
  cursor: pointer;
}

.layers-add-bottom-btn:hover {
  background: #e2f3ff;
}

.layers-add-bottom-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.layer-item {
  border: 2px solid rgba(0, 0, 0, 0.14);
  border-radius: 7px;
  box-sizing: border-box;
  flex: 0 0 180px;
  align-self: flex-start;
  justify-self: start;
  min-width: 180px;
  width: 180px;
  max-width: 180px;
  padding: 6px;
  height: 160px;
  min-height: 160px;
  max-height: 160px;
  background: #F6F8FA;
  cursor: pointer;
  position: relative;
  z-index: 1;
  overflow: visible;
}

.layer-item.active {
  background: #D2D7DC;
  border-color: #ffcc33;
  border-width: 2px;
  box-shadow: 0 0 0 1px rgba(255, 204, 51, 0.2);
  z-index: 10;
}

.layer-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 2px;
}

.layer-preview-tile {
  grid-column: 1 / span 2;
  grid-row: 1 / span 2;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.98);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.layer-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

.layer-preview-warn {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.74rem;
  line-height: 1;
  color: #b56b00;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.layer-item.is-text .layer-text-inline-wrap {
  grid-column: 1 / span 2;
  grid-row: 1 / span 2;
  min-width: 0;
  margin: 0;
}

.layer-item.is-text .layer-text-inline-input {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.96);
  color: #16212b;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 6px 8px;
  resize: none;
}

.layer-item.is-text .layer-text-inline-input:focus {
  outline: 2px solid rgba(0, 153, 204, 0.45);
  outline-offset: 1px;
}

@media (max-width: 900px) and (pointer: coarse) {
  .layer-item.is-text .layer-text-inline-input.is-mobile-text-dialog {
    font-size: 16px;
    cursor: pointer;
  }
}

.layer-wb {
  margin-top: 0;
  display: grid;
  gap: 4px;
}

.menu-surface {
  border-radius: 10px;
  border: 1px solid rgba(236, 243, 247, 0.22);
  background: #2b333b;
  color: rgba(236, 243, 247, 0.95);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.34);
  padding: 0 0 3px;
  display: grid;
  gap: 0;
}

.menu-surface[hidden] {
  display: none !important;
}

.menu-surface .menu-surface-title-bar {
  margin: 0 0 4px;
  min-height: 34px;
  padding: 0 6px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(236, 243, 247, 0.16);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.menu-surface .menu-surface-title-bar .sidebar-section-title {
  margin-bottom: 0;
  color: rgba(236, 243, 247, 0.92);
}

.menu-surface .menu-surface-title-close {
  width: 24px;
  height: 24px;
  min-width: 24px;
}

.menu-surface .menu-surface-item {
  width: 100%;
  min-height: 23px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  padding: 1px 4px 1px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
}

.menu-surface .menu-surface-item:hover:not(:disabled),
.menu-surface .menu-surface-item:focus-visible {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: transparent !important;
}

.menu-surface .menu-surface-item .btn-label {
  white-space: nowrap;
  font-weight: 600;
}

.menu-surface .menu-surface-item img {
  width: 14px;
  height: 14px;
  display: block;
  filter: brightness(0) saturate(100%) invert(94%) sepia(7%) saturate(542%) hue-rotate(175deg) brightness(104%) contrast(98%);
}

.menu-surface .menu-surface-item:disabled {
  background: transparent;
  border-color: transparent;
}

.menu-surface .menu-surface-item.is-active {
  color: #ffffff;
}

.menu-surface .secondary-btn,
.menu-surface .secondary-btn:disabled,
.menu-surface .secondary-btn.is-active {
  background: transparent !important;
  border-color: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: rgba(236, 243, 247, 0.95);
}

.layer-more {
  position: fixed;
  z-index: 34;
  top: 0;
  left: 0;
  transform: none;
  width: min(244px, calc(100% - 8px));
  margin-top: 0;
  padding: 8px;
  border: 1px solid rgba(236, 243, 247, 0.22);
  border-radius: 10px;
  background: #2b333b;
  color: rgba(236, 243, 247, 0.95);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.42);
}

.layer-more[hidden] {
  display: none !important;
}

.layer-more .menu-title-bar.layer-more-title-bar {
  margin: -8px -8px 8px;
  min-height: 34px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(236, 243, 247, 0.16);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.layer-more .menu-title-bar.layer-more-title-bar .sidebar-section-title {
  margin-bottom: 0;
  color: rgba(236, 243, 247, 0.92);
}

.layer-mobile-tools {
  position: fixed;
  z-index: 35;
  left: 0;
  top: 0;
  width: 220px;
}

.layer-wb-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: rgba(236, 243, 247, 0.9);
}

.layer-wb-row.layer-wb-row-divider {
  position: relative;
  margin-bottom: 3px;
  padding-bottom: 7px;
}

.layer-wb-row.layer-wb-row-divider::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(236, 243, 247, 0.18);
}

.layer-wb-slider {
  width: 100%;
  accent-color: var(--ui-slider-accent);
}

.layer-text-controls {
  margin-top: 0;
  display: grid;
  gap: 6px;
}

.layer-text-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: rgba(236, 243, 247, 0.9);
}

.layer-text-row-size {
  grid-template-columns: 72px minmax(0, 1fr) auto;
}

.layer-text-row-angle {
  grid-template-columns: 72px minmax(0, 1fr) auto;
}

.layer-text-row-spacing {
  grid-template-columns: 72px minmax(0, 1fr) auto;
}

.layer-text-row.layer-text-row-divider-top {
  position: relative;
  margin-top: 3px;
  padding-top: 7px;
}

.layer-text-row.layer-text-row-divider-top::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: rgba(236, 243, 247, 0.18);
}

.layer-text-row-block {
  grid-template-columns: 1fr;
  gap: 4px;
}

.layer-text-input {
  width: 100%;
  min-height: 60px;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid rgba(236, 243, 247, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(236, 243, 247, 0.96);
  font-size: 0.76rem;
  line-height: 1.35;
  padding: 6px 8px;
}

.layer-text-input:focus,
.layer-text-color:focus,
.layer-text-hex:focus {
  outline: 2px solid rgba(0, 153, 204, 0.5);
  outline-offset: 1px;
}

.layer-text-select {
  width: 100%;
  min-width: 0;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(236, 243, 247, 0.34);
  background: rgba(16, 20, 24, 0.5);
  color: rgba(236, 243, 247, 0.94);
  font-size: 0.74rem;
  padding: 0 8px;
}

.layer-text-select:focus {
  outline: 1px solid rgba(143, 216, 255, 0.9);
  outline-offset: 1px;
}

.layer-text-color {
  width: 32px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(236, 243, 247, 0.24);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px;
  cursor: pointer;
}

.layer-text-hex {
  width: 100%;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(236, 243, 247, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(236, 243, 247, 0.96);
  font-size: 0.73rem;
  padding: 0 8px;
}

.layer-text-color-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.layer-text-color-presets {
  display: grid;
  grid-template-columns: repeat(6, 18px);
  align-items: center;
  gap: 6px;
}

.layer-text-color-manual {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.layer-text-color-preset {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid rgba(236, 243, 247, 0.34);
  background: #ffffff;
  cursor: pointer;
  padding: 0;
}

.layer-text-color-preset.is-black {
  background: #000000;
}

.layer-text-color-preset.is-blue {
  background: #0099cc;
}

.layer-text-color-preset.is-orange {
  background: #ff7a00;
}

.layer-text-color-preset.is-yellow {
  background: #ffcc33;
}

.layer-text-color-preset.is-red {
  background: #ff0000;
}

.layer-text-color-preset.is-green {
  background: #00aa44;
}

.layer-text-color-preset.is-cyan {
  background: #00bcd4;
}

.layer-text-color-preset.is-purple {
  background: #7a5cff;
}

.layer-text-color-preset.is-transparent {
  border-color: rgba(236, 243, 247, 0.48);
  background-color: #f4f8fb;
  background-image:
    linear-gradient(45deg, #c2cad3 25%, transparent 25%, transparent 75%, #c2cad3 75%, #c2cad3),
    linear-gradient(45deg, #c2cad3 25%, transparent 25%, transparent 75%, #c2cad3 75%, #c2cad3);
  background-size: 10px 10px;
  background-position: 0 0, 5px 5px;
}

.layer-text-color-preset:hover {
  border-color: rgba(236, 243, 247, 0.7);
}

.layer-text-color-preset:focus-visible {
  outline: 2px solid rgba(0, 153, 204, 0.6);
  outline-offset: 1px;
}

.layer-text-size-value,
.layer-text-angle-value,
.layer-text-letter-value,
.layer-text-line-value {
  min-width: 40px;
  text-align: right;
  font-size: 0.67rem;
  letter-spacing: 0.01em;
  color: rgba(236, 243, 247, 0.8);
}

.layer-retro-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.layer-retro-btn {
  border: 1px solid rgba(236, 243, 247, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(236, 243, 247, 0.96);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 2px;
  cursor: pointer;
}

.layer-retro-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(236, 243, 247, 0.34);
}

.layer-retro-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.layer-tuning-toggle {
  grid-column: 1 / -1;
  margin-top: 6px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #f4fbff;
  color: #1f2b38;
  padding: 7px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.layer-tuning-toggle:hover {
  background: #e2f3ff;
}

.layer-tuning-toggle .caret {
  transition: transform 180ms ease;
}

.layer-tuning-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.layer-tuning-label img {
  width: 14px;
  height: 14px;
  display: block;
}

.layer-tuning-toggle.is-open .caret {
  transform: rotate(180deg);
}

.layer-grid-btn {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  box-shadow: none;
  transition: transform 120ms ease, background-color 120ms ease;
}

.layer-tool-btn {
  color: #1b2732;
}

.layer-tool-btn.mobile-more-toggle {
  display: none;
}

.layer-tool-btn img,
.layer-btn img {
  width: 22px;
  height: 22px;
  display: block;
  opacity: 0.86;
  transition: opacity 120ms ease;
}

.layer-grid-btn:hover {
  background: rgba(0, 0, 0, 0.14);
  box-shadow: none;
}

.layer-grid-btn:focus-visible {
  outline: 2px solid rgba(0, 153, 204, 0.45);
  outline-offset: 1px;
  background: transparent;
  box-shadow: none;
}

.layer-grid-btn:focus-visible img {
  opacity: 1;
}

.layer-grid-btn:active {
  transform: scale(0.98);
}

.layer-tool-btn.active {
  background: transparent;
  box-shadow: none;
}

.layer-tool-btn.active img,
.layer-btn.hide.active img {
  opacity: 1;
}

.layer-tool-btn:disabled,
.layer-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.layer-btn {
  color: #1b2732;
}

.layer-btn.up,
.layer-btn.down {
  background: #3B434A;
  border: 1px solid rgba(236, 243, 247, 0.24);
  border-radius: 8px;
}

.layer-btn.up img,
.layer-btn.down img {
  filter: brightness(0) saturate(100%) invert(94%) sepia(7%) saturate(542%) hue-rotate(175deg) brightness(104%) contrast(98%);
  opacity: 0.92;
}

.layer-btn.up:hover,
.layer-btn.down:hover {
  background: #4D545B;
  border-color: rgba(236, 243, 247, 0.36);
}

.layer-btn.hide.active {
  background: transparent;
  box-shadow: none;
}

.layer-tool-btn.delete {
  background: transparent;
}

.layer-tool-btn.delete:hover {
  background: rgba(0, 0, 0, 0.14);
  box-shadow: none;
}

.layer-bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: rgba(8, 12, 18, 0.74);
  display: grid;
  place-items: center;
  padding: 18px;
}

.layer-bg-overlay[hidden] {
  display: none !important;
}

.layer-bg-modal {
  width: min(92vw, 980px);
  height: min(88vh, 760px);
  max-height: 88vh;
  border-radius: 12px;
  border: 1px solid rgba(236, 243, 247, 0.22);
  background: #2b333b;
  color: rgba(236, 243, 247, 0.95);
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.48);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.layer-bg-head {
  padding: 0 12px 10px;
  border-bottom: 1px solid rgba(236, 243, 247, 0.16);
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 10px;
}

.layer-bg-title-bar {
  margin: 0 -12px;
  min-height: 34px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(236, 243, 247, 0.16);
}

.layer-bg-title-bar .sidebar-section-title {
  margin-bottom: 0;
  color: rgba(236, 243, 247, 0.92);
}

.layer-bg-controls-row {
  grid-column: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  justify-self: center;
}

.layer-bg-controls-row .pill-toggle {
  margin-top: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(236, 243, 247, 0.22);
}

.layer-bg-controls-row .pill-toggle button {
  color: rgba(236, 243, 247, 0.9);
  font-size: 0.75rem;
  padding: 5px 12px;
}

.layer-bg-controls-row .pill-toggle button .mode-label {
  white-space: nowrap;
}

.layer-bg-controls-row .pill-toggle button img {
  filter: brightness(0) saturate(100%) invert(94%) sepia(7%) saturate(542%) hue-rotate(175deg) brightness(104%) contrast(98%);
}

.layer-bg-controls-row .pill-toggle button:hover:not(:disabled):not(.active) {
  background: rgba(236, 243, 247, 0.14);
  color: rgba(236, 243, 247, 0.98);
}

.layer-bg-controls-row .pill-toggle button.active {
  background: #0099cc;
  color: #ffffff;
}

.layer-bg-controls-row .pill-toggle button.active img {
  filter: brightness(0) invert(1);
}

.layer-bg-brush-size {
  display: inline-grid;
  grid-template-columns: auto 130px auto;
  align-items: center;
  gap: 6px;
  margin-top: 0;
  font-size: 0.75rem;
  color: rgba(236, 243, 247, 0.9);
  font-weight: 600;
}

.layer-bg-brush-size [data-bg-brush-size-value] {
  min-width: 24px;
  text-align: right;
  font-weight: 700;
  color: rgba(236, 243, 247, 0.96);
}

.layer-bg-canvas-wrap {
  position: relative;
  z-index: 1;
  background: #1f262d;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  display: block;
  min-height: 0;
  padding: 0;
}

.layer-bg-canvas-wrap[data-bg-mode="checker"] {
  background-color: #f3f5f8;
  background-image:
    linear-gradient(45deg, #dce1e7 25%, transparent 25%, transparent 75%, #dce1e7 75%, #dce1e7),
    linear-gradient(45deg, #dce1e7 25%, transparent 25%, transparent 75%, #dce1e7 75%, #dce1e7);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

.layer-bg-canvas-wrap[data-bg-mode="white"] {
  background: #ffffff;
}

.layer-bg-canvas-wrap[data-bg-mode="black"] {
  background: #101418;
}

.layer-bg-canvas-wrap.is-color-pick,
.layer-bg-canvas-wrap.is-color-pick * {
  cursor: crosshair;
}

.layer-bg-canvas-wrap canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  will-change: transform;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.layer-bg-foot {
  position: relative;
  z-index: 4;
  padding: 10px 14px;
  border-top: 1px solid rgba(236, 243, 247, 0.16);
  background: #2b333b;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.layer-bg-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.layer-bg-more-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.layer-bg-more-toggle-btn {
  width: 38px;
  min-width: 38px;
  padding: 0;
  justify-content: center;
  gap: 0;
  border-color: transparent !important;
  background: transparent !important;
}

.layer-bg-more-toggle-btn:hover:not(:disabled),
.layer-bg-more-toggle-btn.is-active {
  border-color: transparent !important;
  background: transparent !important;
}

.layer-bg-more-toggle-btn img {
  width: 20px;
  height: 20px;
}

.layer-bg-more-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 220px;
  z-index: 2147483003;
}

.layer-bg-actions-center {
  grid-column: 2;
}

.layer-bg-actions-right {
  grid-column: 3;
  justify-self: end;
}

.layer-bg-view {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.layer-bg-view-left {
  grid-column: 1;
  justify-self: start;
}

.layer-bg-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.layer-bg-view .cutout-bg-btn {
  border-color: rgba(236, 243, 247, 0.3);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}

.layer-bg-view .cutout-bg-btn[data-editor-bg="white"] {
  background: #ffffff;
}

.layer-bg-view .cutout-bg-btn[data-editor-bg="black"] {
  background: #101418;
}

.layer-bg-view .cutout-bg-btn.active {
  outline: 2px solid #ffcc33;
}

.secondary-btn.is-loading {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.layer-bg-actions .secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(236, 243, 247, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(236, 243, 247, 0.96);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.layer-bg-actions .secondary-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(236, 243, 247, 0.36);
}

.layer-bg-actions .secondary-btn:disabled {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(236, 243, 247, 0.14);
  color: rgba(236, 243, 247, 0.44);
}

.layer-bg-actions .secondary-btn img {
  width: 14px;
  height: 14px;
  display: block;
  filter: brightness(0) saturate(100%) invert(94%) sepia(7%) saturate(542%) hue-rotate(175deg) brightness(104%) contrast(98%);
}

.layer-bg-actions .layer-bg-more-toggle-btn img {
  width: 20px;
  height: 20px;
}

.layer-bg-actions .secondary-btn .btn-label {
  white-space: nowrap;
}

.layer-bg-actions .secondary-btn[data-bg-apply] {
  background: #0099cc;
  border-color: #0099cc;
  color: #ffffff;
}

.layer-bg-actions .secondary-btn[data-bg-apply]:hover:not(:disabled) {
  background: #00a6dd;
  border-color: #00a6dd;
}

.layer-bg-actions .secondary-btn[data-bg-apply] img {
  filter: brightness(0) invert(1);
}

.layer-bg-actions .secondary-btn.is-active {
  background: rgba(0, 153, 204, 0.28);
  border-color: rgba(0, 153, 204, 0.85);
  color: #ffffff;
  font-weight: 700;
}

.secondary-btn .spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: rgba(0, 0, 0, 0.75);
  animation: spin 0.8s linear infinite;
}

.layer-bg-actions .secondary-btn .spinner {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: rgba(255, 255, 255, 0.95);
}

@media (max-width: 920px) {
  .layer-bg-modal {
    width: min(96vw, 980px);
    height: min(90vh, 760px);
  }

  .layer-bg-foot {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    justify-content: stretch;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }

  .layer-bg-view-left,
  .layer-bg-actions-center,
  .layer-bg-actions-right {
    grid-column: auto;
  }

  .layer-bg-view-left {
    justify-self: start;
  }

  .layer-bg-actions-center {
    justify-self: center;
  }

  .layer-bg-actions-right {
    justify-self: end;
  }

  .layer-bg-actions {
    justify-content: center;
    flex-wrap: nowrap;
  }

  .layer-bg-controls-row {
    gap: 8px;
  }

  .layer-bg-brush-size {
    grid-template-columns: auto 96px auto;
    gap: 5px;
  }

  .layer-bg-controls-row .pill-toggle button {
    min-width: 34px;
    padding: 5px 8px;
    justify-content: center;
  }

  .layer-bg-controls-row .pill-toggle button .mode-label {
    display: none;
  }

  .layer-bg-actions-center .secondary-btn {
    width: 34px;
    min-width: 34px;
    padding: 0;
    justify-content: center;
    gap: 0;
  }

  .layer-bg-actions-center .secondary-btn .btn-label {
    display: none;
  }

  .layer-bg-actions-center .layer-bg-more-toggle-btn {
    width: 38px;
    min-width: 38px;
  }

  .layer-bg-more-menu {
    left: auto;
    right: 0;
    width: min(224px, 72vw);
  }

  .layer-bg-more-menu .secondary-btn {
    width: 100%;
    min-width: 0;
    padding: 1px 4px 1px 12px;
    justify-content: flex-start;
    gap: 5px;
  }

  .layer-bg-more-menu .secondary-btn .btn-label {
    display: inline;
  }

  .layer-bg-actions-right .secondary-btn {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .layer-bg-actions-right .secondary-btn[data-bg-cancel] {
    display: none;
  }
}

.layer-bg-brush-preview {
  position: absolute;
  z-index: 8;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 153, 204, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 153, 204, 0.9);
  background: rgba(0, 153, 204, 0.14);
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: none;
}

.layer-bg-brush-preview.restore {
  border-color: rgba(255, 204, 51, 0.95);
  background: rgba(255, 204, 51, 0.14);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9), 0 0 12px rgba(255, 204, 51, 0.9);
}

@media (max-width: 900px) {
  .app-topbar {
    padding: 0 12px;
  }
  .app-title img {
    height: 28px;
  }
  .logo-bolt-hit {
    left: 40px;
    top: 1px;
    width: 22px;
    height: 24px;
  }
  .logo-sparks {
    left: 50px;
    top: 14px;
  }
  .topbar-actions {
    gap: 6px;
  }
  .layers-topbar-actions {
    gap: 1px;
  }
  .layers-topbar-actions .layers-head-btn,
  .layers-topbar-actions .layers-menu-btn,
  .layers-topbar-actions .layers-add-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 6px;
  }
  #btnMergeVisibleLayers {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 6px;
  }
  .layers-topbar-actions .layers-head-btn img,
  .layers-topbar-actions .layers-add-btn img,
  .layers-topbar-actions .layers-menu-icon {
    width: 16px;
    height: 16px;
  }
  #btnMergeVisibleLayers img {
    width: 16px;
    height: 16px;
  }
  .topbar-menu-btn {
    height: 34px;
    padding: 0 8px;
    font-size: 0.9rem;
  }
  .topbar-icon-btn {
    width: 34px;
  }
  .about-panel {
    margin-right: 0;
  }
  .about-panel h2 {
    font-size: clamp(1.9rem, 7.2vw, 2.8rem);
  }
  .hero-carousel {
    padding: 14px 12px 0;
  }
  .hero-head {
    margin-bottom: 2px;
  }
  .hero-scenes-window {
    width: calc(100% + 24px);
    margin: 2px -12px 0;
    min-height: clamp(300px, 52vh, 380px);
  }
  .hero-scene-content {
    min-height: clamp(300px, 52vh, 380px);
    padding: 10px 14px 10px;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 16px;
  }
  .hero-scene-visual {
    width: min(420px, 100%);
  }
  .hero-scene-copy {
    max-width: 100%;
    font-size: clamp(1.05rem, 3.8vw, 1.5rem);
    text-align: center;
  }
  .hero-scene-controls {
    margin-top: 6px;
  }
  .layers-empty-state {
    padding: 0;
  }
  .layers-empty-carousel {
    border-radius: 10px;
    padding: 0;
  }
  .layers-empty-scene-copy {
    bottom: 70px;
    width: min(92%, 440px);
    font-size: clamp(0.95rem, 4.2vw, 1.2rem);
  }
  .layers-empty-scene-arrow.layers-empty-scene-arrow-edge {
    width: 28px;
    height: 44px;
    border-radius: 8px;
  }
  .layers-empty-scene-arrow.layers-empty-scene-arrow-edge.is-prev {
    left: 6px;
  }
  .layers-empty-scene-arrow.layers-empty-scene-arrow-edge.is-next {
    right: 6px;
  }
  .layers-empty-start-btn {
    width: 100%;
    max-width: 260px;
    bottom: 14px;
    min-height: 38px;
    font-size: 0.88rem;
  }
  .layers-empty-state.is-flat-canvas .layers-empty-carousel::after {
    font-size: clamp(0.95rem, 4vw, 1.1rem);
  }
  .page-main {
    padding-right: 0;
  }
  .imagestudio-main { grid-template-columns: 1fr; }
  .imagestudio-main.is-layers { grid-template-columns: 1fr; }
  .side-panel {
    display: block;
  }
  .sidebar {
    width: 100%;
    border-radius: 0;
  }
  .side-panel.is-collapsed .sidebar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .side-panel.is-collapsed .controls-group {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
  }
  .side-panel.is-collapsed .sidebar-quick-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
    margin-top: 0;
  }
  .side-panel.is-collapsed .quick-separator {
    width: 1px;
    height: 20px;
  }
  .sidebar-collapse-row {
    justify-content: flex-end;
  }
  .side-panel.is-collapsed .sidebar-collapse-row {
    margin-top: 0;
    margin-left: auto;
    flex: 0 0 auto;
    align-items: center;
  }
  .side-panel:not(.is-collapsed) .sidebar-open-icon {
    transform: rotate(90deg);
  }
  .side-panel.is-collapsed .sidebar-collapsed-icon {
    transform: rotate(90deg);
  }
  .canvas-wrap { min-height: 0; }
  .model-bar-row #modelBarCanvas {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }
  .canvas-area.is-layers {
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 10px;
    padding-right: 10px;
  }
  .imagestudio-main.is-layers .layers-right-rail {
    display: flex;
    position: relative;
    z-index: 280;
    width: 100%;
    min-width: 0;
    min-height: 0;
    background: #2f353a;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0 6px 10px;
  }
  .imagestudio-main.is-layers .layers-right-rail .layers-panel-head {
    z-index: 3;
  }
  .imagestudio-main.is-layers .layers-right-rail.layer-menus-overlay-open {
    isolation: auto;
  }
  .imagestudio-main.is-layers .layers-right-rail.layer-menus-overlay-open .layers-panel-head {
    z-index: 2;
  }
  .imagestudio-main.is-layers .layers-right-rail.layer-menus-overlay-open .layers-list {
    z-index: 40;
  }
  .imagestudio-main.is-layers .layers-right-rail.layer-menus-overlay-open .layer-more,
  .imagestudio-main.is-layers .layers-right-rail.layer-menus-overlay-open .layer-mobile-tools {
    z-index: 2147483640;
    transform: translateZ(0);
  }
  .imagestudio-main.is-layers .layers-right-rail .layers-list {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-right: 0;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    z-index: 1;
  }
  .imagestudio-main.is-layers .layers-right-rail .layers-list.menus-overlay-open {
    overflow: visible;
    -webkit-overflow-scrolling: auto;
    z-index: 6;
  }
  .imagestudio-main.is-layers .layers-right-rail.layer-menus-overlay-open .layers-panel-head {
    z-index: 2;
  }
  .imagestudio-main.is-layers .layers-right-rail.layer-menus-overlay-open .layers-list {
    z-index: 6;
  }
  .imagestudio-main.is-layers .layers-right-rail .layers-panel-head.is-menu-open {
    z-index: 50;
  }
  .imagestudio-main.is-layers .layers-right-rail .layer-item {
    flex: 0 0 180px;
    min-width: 180px;
    width: 180px;
    max-width: 180px;
    height: 132px;
    min-height: 132px;
    max-height: 132px;
    justify-self: start;
    scroll-snap-align: start;
  }
  .imagestudio-main.is-layers .layer-item .layer-grid {
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }
  .imagestudio-main.is-layers .layers-right-rail .layers-panel-foot {
    display: none;
  }
  .imagestudio-main.is-layers .layer-item .layer-tool-btn.fill,
  .imagestudio-main.is-layers .layer-item .layer-tool-btn.flipx,
  .imagestudio-main.is-layers .layer-item .layer-tool-btn.flipy,
  .imagestudio-main.is-layers .layer-item .layer-tool-btn.shadow,
  .imagestudio-main.is-layers .layer-item .layer-tool-btn.reset {
    display: none;
  }
  .imagestudio-main.is-layers .layer-item .layer-tool-btn.mobile-more-toggle {
    display: grid;
  }
  .imagestudio-main.is-layers .layer-item .layer-tool-btn.cutout,
  .imagestudio-main.is-layers .layer-item .layer-tool-btn.textalign {
    grid-column: 1;
    grid-row: 3;
  }
  .imagestudio-main.is-layers .layer-item .layer-tool-btn.adjust {
    grid-column: 2;
    grid-row: 3;
  }
  .imagestudio-main.is-layers .layer-item .layer-tool-btn.mobile-more-toggle {
    grid-column: 3;
    grid-row: 3;
  }
  .imagestudio-main.is-layers .layer-item .layer-tool-btn.delete {
    grid-column: 4;
    grid-row: 3;
  }
}

@media (max-width: 900px) and (pointer: coarse) {
  body {
    overflow: auto;
  }
}
