:root {
  color-scheme: dark;
  --bg: #07020f;
  --panel: rgba(28, 16, 48, 0.72);
  --panel-strong: rgba(18, 8, 33, 0.86);
  --border: rgba(168, 85, 247, 0.25);
  --border-strong: rgba(192, 132, 252, 0.62);
  --accent: #a855f7;
  --accent-2: #67e8f9;
  --text: #f5f3ff;
  --muted: #b8a8d9;
  --danger: #fb7185;
  --success: #4ade80;
  --radius: 18px;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
  --transition: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  font-family:
    Inter, Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Segoe UI Symbol", "Noto Sans Symbols 2", "Noto Sans Symbols", "Arial Unicode MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(168, 85, 247, 0.32), transparent 32rem),
    radial-gradient(circle at 92% 82%, rgba(34, 211, 238, 0.16), transparent 34rem),
    radial-gradient(circle at 50% 42%, rgba(139, 92, 246, 0.13), transparent 42rem),
    linear-gradient(145deg, #07020f 0%, #0d061a 46%, #120821 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  opacity: 0.3;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(circle at 50% 20%, black, transparent 72%);
}

body::after {
  opacity: 0.08;
  background-image:
    radial-gradient(circle at 1px 1px, #ffffff 1px, transparent 0);
  background-size: 18px 18px;
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
.toggle-row:focus-within {
  outline: 2px solid rgba(103, 232, 249, 0.86);
  outline-offset: 3px;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.home-shell {
  justify-content: flex-start;
}

.hero-card,
.control-panel,
.workspace {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(28, 16, 48, 0.76), rgba(12, 6, 24, 0.78));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(24px);
}

.hero-card::before,
.workspace::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg, rgba(168, 85, 247, 0.55), transparent 38%, rgba(103, 232, 249, 0.28));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.hero-card {
  min-height: 126px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  animation: cardIn 520ms var(--transition) both;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  width: 100%;
}

.brand-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
  filter: drop-shadow(0 0 24px rgba(168, 85, 247, 0.66));
  transition: transform var(--transition), filter var(--transition);
}

.brand-logo:hover {
  transform: translateY(-2px) scale(1.05);
  filter: drop-shadow(0 0 34px rgba(103, 232, 249, 0.48)) drop-shadow(0 0 24px rgba(168, 85, 247, 0.55));
}

.brand-copy {
  min-width: 0;
}

.section-label {
  margin: 0;
  color: var(--accent-2);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 4.45rem);
  line-height: 1.16;
  padding-bottom: 0.08em;
  color: transparent;
  background: linear-gradient(110deg, #ffffff 0%, #ede9fe 45%, #c084fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 34px rgba(168, 85, 247, 0.34);
}

h2 {
  margin-top: 5px;
  font-size: clamp(1.18rem, 2vw, 1.55rem);
}

.converter-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.page-nav a {
  min-height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(184, 168, 217, 0.18);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  text-decoration: none;
  font-weight: 850;
  transition:
    transform var(--transition),
    border-color var(--transition),
    color var(--transition),
    background var(--transition);
}

.page-nav a:hover,
.page-nav a.is-active {
  transform: translateY(-1px);
  border-color: rgba(103, 232, 249, 0.34);
  color: var(--text);
  background: rgba(103, 232, 249, 0.08);
}

.page-nav a:focus-visible {
  outline: 2px solid rgba(103, 232, 249, 0.86);
  outline-offset: 3px;
}

.gui-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.home-intro {
  padding: 22px;
}

.home-intro-copy {
  max-width: 760px;
}

.home-intro-copy p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

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

.tool-card {
  position: relative;
  min-height: 260px;
  padding: 20px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: linear-gradient(145deg, rgba(28, 16, 48, 0.76), rgba(12, 6, 24, 0.78));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(24px);
  text-decoration: none;
  animation: cardIn 620ms var(--transition) both;
  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition),
    opacity var(--transition);
}

.tool-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg, rgba(168, 85, 247, 0.5), transparent 42%, rgba(103, 232, 249, 0.24));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.tool-card::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at 18% 0%, rgba(103, 232, 249, 0.16), transparent 40%);
  transition: opacity var(--transition);
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: rgba(192, 132, 252, 0.56);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.5), 0 0 38px rgba(168, 85, 247, 0.16);
}

.tool-card:hover::after {
  opacity: 1;
}

.tool-card:focus-visible {
  outline: 2px solid rgba(103, 232, 249, 0.86);
  outline-offset: 3px;
}

.tool-card.is-soon {
  opacity: 0.78;
}

.tool-card.is-soon:hover {
  transform: translateY(-2px);
}

.tool-orb,
.tool-content,
.tool-arrow,
.tool-status {
  position: relative;
  z-index: 1;
}

.tool-orb {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #f5f3ff;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.34), rgba(103, 232, 249, 0.1));
  border: 1px solid rgba(192, 132, 252, 0.28);
  box-shadow: 0 0 28px rgba(168, 85, 247, 0.18);
  font-weight: 950;
  font-size: 1.15rem;
}

.tool-content {
  align-self: end;
  display: grid;
  gap: 9px;
}

.tool-content strong {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.tool-content small {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.tool-arrow,
.tool-status {
  justify-self: start;
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(103, 232, 249, 0.26);
  border-radius: 999px;
  color: #dffbff;
  background: rgba(103, 232, 249, 0.08);
  font-weight: 900;
}

.tool-arrow {
  font-size: 1.15rem;
}

.tool-status {
  color: var(--muted);
  border-color: rgba(184, 168, 217, 0.18);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.78rem;
}

.control-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: cardIn 620ms var(--transition) 80ms both;
}

.select-field,
.text-field {
  display: grid;
  gap: 8px;
}

.select-field span,
.text-field span {
  color: #d9ccf5;
  font-size: 0.86rem;
  font-weight: 850;
}

select,
input[type="text"] {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid rgba(168, 85, 247, 0.24);
  border-radius: 14px;
  color: var(--text);
  background: rgba(4, 2, 10, 0.72);
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

select:focus,
input[type="text"]:focus {
  border-color: rgba(103, 232, 249, 0.68);
  box-shadow:
    0 0 0 4px rgba(103, 232, 249, 0.08),
    0 0 28px rgba(103, 232, 249, 0.1);
}

input[type="text"]::placeholder {
  color: rgba(184, 168, 217, 0.72);
}

.slot-form {
  display: grid;
  gap: 10px;
}

.helper-text,
.empty-slots {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.slot-list {
  min-height: 58px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.slot-chip {
  min-width: 42px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(103, 232, 249, 0.24);
  border-radius: 999px;
  color: var(--text);
  background: rgba(103, 232, 249, 0.08);
  cursor: pointer;
  font-weight: 850;
  transition:
    transform var(--transition),
    border-color var(--transition),
    background var(--transition);
}

.slot-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(251, 113, 133, 0.52);
  background: rgba(251, 113, 133, 0.1);
}

.panel-block {
  display: grid;
  gap: 11px;
}

.mode-list {
  display: grid;
  gap: 10px;
}

.mode-option,
.segment,
.action-button,
.toggle-row {
  border: 1px solid rgba(184, 168, 217, 0.18);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  transition:
    transform var(--transition),
    border-color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
}

.mode-option:hover,
.segment:hover,
.action-button:hover,
.toggle-row:hover {
  transform: translateY(-2px);
  border-color: rgba(192, 132, 252, 0.56);
  background: rgba(255, 255, 255, 0.07);
}

.mode-option:active,
.segment:active,
.action-button:active {
  transform: scale(0.98);
}

.mode-option {
  position: relative;
  min-height: 72px;
  padding: 13px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  overflow: hidden;
}

.mode-option::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at 20% 0%, rgba(103, 232, 249, 0.18), transparent 42%);
  transition: opacity var(--transition);
}

.mode-option.is-active {
  border-color: rgba(168, 85, 247, 0.9);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.28), rgba(103, 232, 249, 0.08));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 32px rgba(168, 85, 247, 0.18);
}

.mode-option.is-active::before {
  opacity: 1;
}

.mode-icon,
.mode-text,
.mode-check {
  position: relative;
  z-index: 1;
}

.mode-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #f5f3ff;
  background: rgba(168, 85, 247, 0.16);
  border: 1px solid rgba(192, 132, 252, 0.24);
  font-weight: 950;
}

.mode-icon.bubble {
  color: var(--accent-2);
  font-size: 1.45rem;
}

.mode-icon.large {
  font-size: 1.1rem;
}

.mode-text {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.mode-text strong {
  font-weight: 900;
}

.mode-text small,
.toggle-row small,
.counter {
  color: var(--muted);
}

.mode-check {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #071013;
  background: linear-gradient(135deg, var(--success), var(--accent-2));
  opacity: 0;
  transform: scale(0.75);
  transition: opacity var(--transition), transform var(--transition);
  font-size: 0.78rem;
  font-weight: 950;
}

.mode-option.is-active .mode-check {
  opacity: 1;
  transform: scale(1);
}

.segmented {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(184, 168, 217, 0.16);
  border-radius: 16px;
  background: rgba(4, 2, 10, 0.34);
}

.segment {
  min-height: 46px;
  padding: 0 12px;
  border-radius: 12px;
  border-color: transparent;
  background: transparent;
  font-weight: 850;
}

.segment.is-active {
  border-color: rgba(168, 85, 247, 0.56);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.5), rgba(103, 232, 249, 0.1));
  box-shadow: 0 12px 30px rgba(168, 85, 247, 0.16);
}

.toggle-row {
  min-height: 72px;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

.toggle-row.is-disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.toggle-row span:first-child {
  display: grid;
  gap: 3px;
}

.toggle-row strong {
  font-weight: 900;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle {
  position: relative;
  width: 58px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(184, 168, 217, 0.22);
  background: rgba(61, 48, 82, 0.72);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.28);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f5f3ff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
  transition: transform 220ms var(--transition), box-shadow var(--transition);
}

.toggle-row input:checked + .toggle {
  border-color: rgba(103, 232, 249, 0.52);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 24px rgba(103, 232, 249, 0.16);
}

.toggle-row input:checked + .toggle::after {
  transform: translateX(26px);
  box-shadow: 0 8px 20px rgba(103, 232, 249, 0.28);
}

.preview-card {
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(184, 168, 217, 0.15);
  border-radius: 16px;
  background: rgba(6, 3, 14, 0.62);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.2);
}

.preview-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preview-card code {
  display: block;
  min-height: 42px;
  margin-top: 14px;
  overflow-wrap: anywhere;
  color: #ffffff;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 1.08rem;
  line-height: 1.5;
  transition: opacity var(--transition), transform var(--transition);
}

.preview-card code.is-updating,
#resultText.is-updating {
  opacity: 0.72;
}

.workspace {
  min-width: 0;
  padding: 18px;
  display: grid;
  gap: 16px;
  overflow: hidden;
  animation: cardIn 620ms var(--transition) 150ms both;
}

.gui-workspace {
  align-content: start;
}

.canvas-stage {
  min-height: 430px;
  padding: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(168, 85, 247, 0.18);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(4, 2, 10, 0.78), rgba(9, 4, 18, 0.82)),
    radial-gradient(circle at 50% 0%, rgba(103, 232, 249, 0.08), transparent 22rem);
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.22);
}

#guiCanvas {
  width: min(100%, 704px);
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 24px 42px rgba(0, 0, 0, 0.42));
  touch-action: none;
  cursor: crosshair;
}

#guiCanvas[data-tool="bucket"] {
  cursor: cell;
}

#guiCanvas[data-tool="eyedropper"] {
  cursor: copy;
}

.paint-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.paint-tool {
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid rgba(184, 168, 217, 0.18);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  font-weight: 900;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.paint-tool:hover,
.paint-tool.is-active {
  border-color: rgba(103, 232, 249, 0.58);
  background: linear-gradient(135deg, rgba(103, 232, 249, 0.14), rgba(168, 85, 247, 0.22));
  box-shadow: 0 0 22px rgba(103, 232, 249, 0.1);
}

.color-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 8px;
}

.color-row input[type="text"] {
  text-transform: lowercase;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

input[type="range"] {
  width: 100%;
  accent-color: #a855f7;
}

.gui-shell {
  width: min(1460px, calc(100% - 32px));
}

.gui-editor-layout {
  grid-template-columns: minmax(270px, 310px) minmax(440px, 1fr) minmax(290px, 330px);
  align-items: stretch;
}

.gui-side-panel,
.premium-preview {
  min-height: 680px;
}

.gui-side-panel {
  padding: 16px;
  gap: 14px;
  background:
    linear-gradient(145deg, rgba(25, 16, 45, 0.78), rgba(18, 10, 33, 0.92)),
    radial-gradient(circle at 0% 0%, rgba(168, 85, 247, 0.14), transparent 20rem);
}

.paint-panel {
  background:
    linear-gradient(145deg, rgba(18, 10, 33, 0.94), rgba(25, 16, 45, 0.76)),
    radial-gradient(circle at 100% 0%, rgba(34, 211, 238, 0.12), transparent 20rem);
}

.panel-head {
  display: grid;
  gap: 5px;
  padding: 4px 2px 2px;
}

.panel-head h2 {
  margin-top: 0;
}

.panel-head p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.editor-card {
  position: relative;
  padding: 14px;
  border: 1px solid rgba(168, 85, 247, 0.18);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.022)),
    rgba(4, 2, 10, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 18px 42px rgba(0, 0, 0, 0.16);
}

.editor-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 12% 0%, rgba(103, 232, 249, 0.07), transparent 42%);
}

.block-title,
.preview-status,
.brush-row,
.quick-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.block-title {
  position: relative;
  z-index: 1;
  align-items: flex-start;
}

.block-title strong {
  display: block;
  font-weight: 950;
}

.block-title small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.block-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(192, 132, 252, 0.24);
  border-radius: 11px;
  color: var(--accent-2);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(103, 232, 249, 0.08));
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.12);
  font-weight: 950;
}

.native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.custom-select {
  position: relative;
  z-index: 3;
}

.custom-select.is-open {
  z-index: 80;
}

.custom-select-trigger {
  width: 100%;
  min-height: 48px;
  padding: 0 13px 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(168, 85, 247, 0.28);
  border-radius: 14px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(12, 6, 24, 0.92), rgba(4, 2, 10, 0.82)),
    radial-gradient(circle at 100% 0%, rgba(103, 232, 249, 0.08), transparent 12rem);
  cursor: pointer;
  font-weight: 900;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition), background var(--transition);
}

.custom-select-trigger:hover,
.custom-select.is-open .custom-select-trigger,
.custom-select-trigger:focus-visible {
  border-color: rgba(103, 232, 249, 0.58);
  box-shadow: 0 0 0 4px rgba(103, 232, 249, 0.08), 0 0 28px rgba(168, 85, 247, 0.14);
}

.custom-select-arrow {
  color: var(--accent-2);
  transition: transform var(--transition);
}

.custom-select.is-open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  z-index: 90;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 250px;
  padding: 7px;
  display: grid;
  gap: 5px;
  overflow: auto;
  border: 1px solid rgba(168, 85, 247, 0.34);
  border-radius: 15px;
  background: rgba(10, 5, 21, 0.94);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.46), 0 0 30px rgba(168, 85, 247, 0.13);
  backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

.custom-select.is-open .custom-select-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.custom-select-option {
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-weight: 850;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.custom-select-option:hover,
.custom-select-option.is-selected {
  border-color: rgba(103, 232, 249, 0.28);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.28), rgba(103, 232, 249, 0.08));
}

.custom-select-option:hover {
  transform: translateX(2px);
}

.premium-preview {
  padding: 18px;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background:
    linear-gradient(145deg, rgba(18, 10, 33, 0.92), rgba(25, 16, 45, 0.72)),
    radial-gradient(circle at 50% 0%, rgba(168, 85, 247, 0.18), transparent 24rem);
}

.editor-preview-head {
  align-items: center;
}

.preview-status {
  padding: 9px 12px;
  border: 1px solid rgba(103, 232, 249, 0.18);
  border-radius: 14px;
  background: rgba(103, 232, 249, 0.055);
}

.preview-status span,
.preview-status small {
  display: block;
}

.preview-status span {
  font-weight: 950;
}

.preview-status small {
  color: var(--muted);
  font-size: 0.78rem;
}

.zoom-toolbar {
  min-height: 52px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(184, 168, 217, 0.14);
  border-radius: 16px;
  background: rgba(4, 2, 10, 0.36);
}

.zoom-toolbar > span {
  margin-right: auto;
  padding-left: 8px;
  color: var(--muted);
  font-weight: 900;
}

.zoom-toolbar strong {
  min-width: 56px;
  text-align: center;
  color: #f5f3ff;
}

.icon-button,
.ghost-button {
  min-height: 36px;
  border: 1px solid rgba(184, 168, 217, 0.18);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  font-weight: 950;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.icon-button {
  width: 38px;
  font-size: 1.15rem;
}

.ghost-button {
  padding: 0 13px;
}

.icon-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  border-color: rgba(103, 232, 249, 0.52);
  background: rgba(103, 232, 249, 0.09);
  box-shadow: 0 0 22px rgba(103, 232, 249, 0.1);
}

.editor-canvas-stage {
  min-height: 520px;
  place-items: start center;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(192, 132, 252, 0.9) rgba(10, 5, 21, 0.82);
  background:
    linear-gradient(180deg, rgba(4, 2, 10, 0.72), rgba(9, 4, 18, 0.86)),
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.035) 75%);
  background-size: auto, 28px 28px, 28px 28px, 28px 28px, 28px 28px;
  background-position: 0 0, 0 0, 0 14px, 14px -14px, -14px 0;
}

.control-panel,
.editor-card,
.slot-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(192, 132, 252, 0.9) rgba(10, 5, 21, 0.82);
}

.editor-canvas-stage::-webkit-scrollbar,
.control-panel::-webkit-scrollbar,
.editor-card::-webkit-scrollbar,
.slot-list::-webkit-scrollbar,
.selected-slots-card .slot-list::-webkit-scrollbar {
  width: 13px;
  height: 13px;
}

.editor-canvas-stage::-webkit-scrollbar-track,
.control-panel::-webkit-scrollbar-track,
.editor-card::-webkit-scrollbar-track,
.slot-list::-webkit-scrollbar-track,
.selected-slots-card .slot-list::-webkit-scrollbar-track {
  border: 1px solid rgba(168, 85, 247, 0.16);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(4, 2, 10, 0.94), rgba(18, 10, 33, 0.9)),
    rgba(10, 5, 21, 0.82);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.42);
}

.editor-canvas-stage::-webkit-scrollbar-thumb,
.control-panel::-webkit-scrollbar-thumb,
.editor-card::-webkit-scrollbar-thumb,
.slot-list::-webkit-scrollbar-thumb,
.selected-slots-card .slot-list::-webkit-scrollbar-thumb {
  border: 3px solid rgba(10, 5, 21, 0.94);
  border-radius: 999px;
  background:
    linear-gradient(135deg, #8b5cf6, #c084fc 48%, #67e8f9);
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.28);
}

.editor-canvas-stage::-webkit-scrollbar-thumb:hover,
.control-panel::-webkit-scrollbar-thumb:hover,
.editor-card::-webkit-scrollbar-thumb:hover,
.slot-list::-webkit-scrollbar-thumb:hover,
.selected-slots-card .slot-list::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(135deg, #a855f7, #d8b4fe 48%, #67e8f9);
  box-shadow: 0 0 24px rgba(103, 232, 249, 0.3);
}

.editor-canvas-stage::-webkit-scrollbar-corner,
.control-panel::-webkit-scrollbar-corner,
.editor-card::-webkit-scrollbar-corner,
.slot-list::-webkit-scrollbar-corner,
.selected-slots-card .slot-list::-webkit-scrollbar-corner {
  background: rgba(10, 5, 21, 0.82);
}

.canvas-frame {
  position: relative;
  min-width: max-content;
  padding: 28px;
  display: grid;
  place-items: center;
}

.pixel-cursor {
  position: absolute;
  z-index: 2;
  display: block;
  border: 1px solid rgba(103, 232, 249, 0.95);
  border-radius: 3px;
  background: rgba(103, 232, 249, 0.32);
  box-shadow:
    0 0 0 2px rgba(168, 85, 247, 0.32),
    0 0 12px rgba(103, 232, 249, 0.9),
    0 0 24px rgba(168, 85, 247, 0.48);
  opacity: 0;
  pointer-events: none;
  transform: scale(1.35);
  transform-origin: center;
  transition: opacity 90ms var(--transition), transform 90ms var(--transition);
}

.pixel-cursor.is-visible {
  opacity: 1;
  transform: scale(1);
}

.editor-canvas-stage #guiCanvas {
  max-width: none;
  transform-origin: center center;
  transition: width 140ms var(--transition), filter var(--transition);
}

.editor-canvas-stage #guiCanvas:hover {
  filter: drop-shadow(0 24px 42px rgba(0, 0, 0, 0.42)) drop-shadow(0 0 22px rgba(103, 232, 249, 0.18));
}

#guiCanvas[data-tool="eraser"] {
  cursor: not-allowed;
}

.preview-actions {
  justify-content: flex-end;
}

.paint-tools {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.paint-tool {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
}

.paint-tool span {
  color: var(--accent-2);
  font-size: 1rem;
}

.paint-tool.is-active {
  color: #ffffff;
  border-color: rgba(192, 132, 252, 0.86);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.72), rgba(34, 211, 238, 0.16));
  box-shadow: 0 14px 32px rgba(168, 85, 247, 0.18), 0 0 26px rgba(103, 232, 249, 0.1);
}

.color-preview {
  --active-color: #ffffff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0)),
    var(--active-color);
}

.premium-color-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
}

.color-picker-trigger {
  min-height: 48px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 7px;
  border: 1px solid rgba(184, 168, 217, 0.22);
  border-radius: 14px;
  color: #f6efff;
  background:
    linear-gradient(135deg, rgba(103, 232, 249, 0.1), rgba(168, 85, 247, 0.08)),
    rgba(5, 2, 12, 0.86);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.color-picker-trigger:hover,
.color-picker-trigger[aria-expanded="true"] {
  border-color: rgba(103, 232, 249, 0.78);
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.09), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.color-picker-trigger:active {
  transform: translateY(1px);
}

.color-picker-chip {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)),
    var(--active-color, #ffffff);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18), 0 8px 18px rgba(0, 0, 0, 0.22);
}

.color-popover {
  --picker-hue: 0;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(103, 232, 249, 0.22);
  border-radius: 16px;
  background:
    radial-gradient(circle at 18% 0%, rgba(103, 232, 249, 0.12), transparent 38%),
    linear-gradient(180deg, rgba(27, 18, 43, 0.98), rgba(8, 3, 17, 0.98));
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.36), inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.color-area {
  position: relative;
  height: 142px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: crosshair;
  overflow: hidden;
  background:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #fff, hsl(var(--picker-hue) 100% 50%));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.24);
}

.color-area-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.65), 0 0 18px rgba(103, 232, 249, 0.72);
  pointer-events: none;
}

.hue-control {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: #c9b8e8;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hue-control input[type="range"] {
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}

.rgb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.rgb-grid label {
  display: grid;
  gap: 5px;
  color: #c9b8e8;
  font-size: 0.74rem;
  font-weight: 900;
}

.rgb-grid input {
  width: 100%;
  min-height: 40px;
  padding: 0 8px;
  border: 1px solid rgba(184, 168, 217, 0.2);
  border-radius: 12px;
  color: #f6efff;
  background: rgba(4, 2, 10, 0.78);
  font: inherit;
  font-weight: 900;
  outline: none;
}

.rgb-grid input:focus {
  border-color: rgba(103, 232, 249, 0.74);
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.1);
}

.color-picker-panel {
  --color-bg: #07020f;
  --color-panel: rgba(25, 16, 45, 0.82);
  --color-panel-strong: rgba(12, 7, 22, 0.9);
  --color-border: rgba(168, 85, 247, 0.25);
  --color-border-active: #67e8f9;
  --color-accent: #8b5cf6;
  --color-accent-2: #22d3ee;
  --color-text: #f5f3ff;
  --color-muted: #b8a8d9;
  --color-danger: #fb7185;
  --color-success: #4ade80;
  gap: 14px;
  padding: 16px;
  overflow: hidden;
}

.color-picker-panel *,
.color-picker-panel *::before,
.color-picker-panel *::after {
  box-sizing: border-box;
}

.color-picker-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.color-picker-header small,
.color-picker-title-row strong,
.active-color-copy strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.color-picker-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  box-shadow: 0 0 20px rgba(103, 232, 249, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.color-picker-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.color-picker-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid rgba(103, 232, 249, 0.26);
  border-radius: 999px;
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.08);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.active-color-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(103, 232, 249, 0.08), rgba(139, 92, 246, 0.08)),
    var(--color-panel-strong);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  min-width: 0;
}

.active-color-preview {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), transparent 48%),
    var(--active-color, #ffffff);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.16), 0 14px 26px rgba(0, 0, 0, 0.24);
}

.active-color-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.active-color-copy span,
.hex-input-group > span,
.color-picker-section-head,
.rgb-input-card > span {
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.active-color-copy strong {
  color: var(--color-text);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(0.92rem, 4vw, 1.08rem);
  letter-spacing: 0;
}

.color-copy-button {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #67e8f9;
  background: rgba(103, 232, 249, 0.08);
}

.color-copy-button:hover,
.color-copy-button:focus-visible {
  border-color: rgba(103, 232, 249, 0.72);
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.1), 0 12px 22px rgba(0, 0, 0, 0.25);
}

.hex-input-group {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.hex-input-shell {
  display: grid;
  min-width: 0;
}

.hex-input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(184, 168, 217, 0.24);
  border-radius: 14px;
  color: var(--color-text);
  background: rgba(4, 2, 10, 0.8);
  font: inherit;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-weight: 900;
  outline: none;
  text-transform: uppercase;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.hex-input:focus {
  border-color: var(--color-border-active);
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.11);
}

.hex-input.is-invalid {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.12);
  animation: invalid-shake 160ms ease;
}

.color-picker-error {
  color: var(--color-danger);
  font-size: 0.74rem;
  font-weight: 800;
}

.color-popover {
  display: grid;
  gap: 12px;
  margin-top: 0;
  padding: 13px;
  border: 1px solid rgba(168, 85, 247, 0.27);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 0%, rgba(34, 211, 238, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(25, 16, 45, 0.92), rgba(8, 3, 17, 0.94));
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  animation: picker-in 180ms ease both;
  min-width: 0;
}

.color-popover[hidden] {
  display: none;
}

.color-collapse-trigger {
  min-width: 0;
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid rgba(168, 85, 247, 0.27);
  border-radius: 15px;
  color: var(--color-muted);
  background:
    linear-gradient(135deg, rgba(103, 232, 249, 0.08), rgba(139, 92, 246, 0.1)),
    rgba(8, 3, 17, 0.88);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 1000;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.color-collapse-trigger:hover,
.color-collapse-trigger:focus-visible,
.color-collapse-trigger[aria-expanded="true"] {
  border-color: rgba(103, 232, 249, 0.72);
  color: #f5f3ff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.1), 0 14px 26px rgba(0, 0, 0, 0.22);
}

.color-collapse-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #67e8f9;
}

.color-collapse-arrow {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 9px;
  color: #f5f3ff;
  background: rgba(103, 232, 249, 0.1);
  transition: transform var(--transition), background var(--transition);
}

.color-collapse-trigger[aria-expanded="true"] .color-collapse-arrow {
  transform: rotate(180deg);
  background: rgba(139, 92, 246, 0.24);
}

.color-picker-inner-head {
  display: none;
}

.color-picker-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.color-picker-section-head strong,
#hueValue {
  flex: 0 0 auto;
  color: #67e8f9;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
}

.color-area {
  height: clamp(142px, 34vw, 178px);
  touch-action: none;
  user-select: none;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0) 100%),
    linear-gradient(to right, #fff 0%, hsl(var(--picker-hue) 100% 50%) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.38),
    inset 0 -28px 42px rgba(0, 0, 0, 0.18),
    0 14px 28px rgba(0, 0, 0, 0.22);
}

.color-area:focus-visible {
  outline: none;
  border-color: var(--color-border-active);
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.12), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.color-area-handle {
  width: 17px;
  height: 17px;
  border: 2px solid #fff;
  transition: left 80ms linear, top 80ms linear;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.86),
    0 0 0 5px rgba(103, 232, 249, 0.12),
    0 0 18px rgba(103, 232, 249, 0.85);
}

.hue-control {
  grid-template-columns: 34px minmax(0, 1fr);
  margin-top: 0;
  gap: 8px;
  color: var(--color-muted);
  min-width: 0;
  overflow: hidden;
}

.hue-control input[type="range"] {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  outline: none;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.22), 0 12px 22px rgba(0, 0, 0, 0.2);
}

.hue-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: hsl(var(--picker-hue) 100% 50%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.75), 0 0 18px rgba(103, 232, 249, 0.72);
  cursor: pointer;
}

.hue-control input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: hsl(var(--picker-hue) 100% 50%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.75), 0 0 18px rgba(103, 232, 249, 0.72);
  cursor: pointer;
}

.rgb-block {
  display: grid;
  gap: 8px;
}

.rgb-grid {
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 0;
}

.rgb-input-card {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.rgb-stepper {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 26px;
  align-items: center;
  min-width: 0;
  border: 1px solid rgba(184, 168, 217, 0.22);
  border-radius: 13px;
  background: rgba(4, 2, 10, 0.76);
  overflow: hidden;
}

.rgb-stepper button {
  width: 26px;
  min-width: 0;
  min-height: 38px;
  padding: 0;
  border: 0;
  color: #67e8f9;
  background: rgba(103, 232, 249, 0.07);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.rgb-stepper button:hover,
.rgb-stepper button:focus-visible {
  color: #f5f3ff;
  background: rgba(139, 92, 246, 0.3);
  outline: none;
}

.rgb-stepper input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0 4px;
  border: 0;
  border-inline: 1px solid rgba(184, 168, 217, 0.16);
  border-radius: 0;
  color: var(--color-text);
  background: transparent;
  font: inherit;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-weight: 900;
  text-align: center;
  outline: none;
}

.rgb-stepper input::-webkit-outer-spin-button,
.rgb-stepper input::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.rgb-stepper input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.color-picker-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.eyedropper-shortcut,
.reset-color-button {
  min-height: 44px;
  border-radius: 14px;
  width: 100%;
  min-width: 0;
  white-space: normal;
}

.eyedropper-shortcut[aria-pressed="true"] {
  border-color: rgba(103, 232, 249, 0.74);
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.1), 0 12px 24px rgba(34, 211, 238, 0.12);
}

.color-presets,
.recent-colors {
  display: grid;
  gap: 8px;
}

.swatch-grid,
.recent-color-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
  gap: 8px;
  overflow: hidden;
}

.color-swatch {
  position: relative;
  min-height: 40px;
  border-radius: 13px;
  overflow: hidden;
}

.color-swatch::after {
  content: "✓";
  position: absolute;
  inset: auto 6px 6px auto;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #06101a;
  background: #67e8f9;
  font-size: 0.7rem;
  font-weight: 1000;
  opacity: 0;
  transform: scale(0.72);
  transition: opacity var(--transition), transform var(--transition);
}

.color-swatch.is-active::after {
  opacity: 1;
  transform: scale(1);
}

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

@keyframes invalid-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  40% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

@media (max-width: 420px) {
  .active-color-card,
  .color-picker-actions {
    grid-template-columns: 1fr;
  }

  .active-color-preview {
    width: 100%;
  }

  .rgb-grid {
    grid-template-columns: 1fr;
  }
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.color-swatch {
  aspect-ratio: 1;
  border: 1px solid rgba(184, 168, 217, 0.2);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0)),
    var(--swatch);
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.12);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.color-swatch:hover,
.color-swatch.is-active {
  transform: translateY(-2px) scale(1.04);
  border-color: rgba(103, 232, 249, 0.72);
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.09), 0 12px 22px rgba(0, 0, 0, 0.24);
}

.color-picker-panel .swatch-grid,
.color-picker-panel .recent-color-list {
  grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
  overflow: hidden;
}

.color-picker-panel .color-swatch {
  min-height: 40px;
  border-radius: 13px;
  position: relative;
  overflow: hidden;
}

.brush-row {
  align-items: center;
}

.brush-row input {
  flex: 1;
}

.brush-row strong {
  min-width: 48px;
  color: var(--accent-2);
  font-size: 0.86rem;
  text-align: right;
}

input[type="range"] {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8b5cf6, #67e8f9);
  cursor: pointer;
}

input[type="range"]:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  filter: saturate(0.6);
}

.brush-preview {
  min-height: 58px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(103, 232, 249, 0.22);
  border-radius: 14px;
  background: rgba(4, 2, 10, 0.28);
}

.brush-preview span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c084fc, #67e8f9);
  box-shadow: 0 0 22px rgba(103, 232, 249, 0.28);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-info-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: center;
}

.tool-info-grid span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.tool-info-grid strong {
  justify-self: end;
  font-size: 0.88rem;
}

.selected-slots-card .slot-list {
  max-height: 168px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(192, 132, 252, 0.9) rgba(10, 5, 21, 0.82);
}

.slot-chip {
  animation: chipIn 180ms var(--transition) both;
}

@keyframes chipIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 2px 0;
}

.editor-grid {
  min-height: 470px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.editor-field {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 9px;
}

.field-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d9ccf5;
  font-weight: 900;
}

.field-title span {
  color: var(--accent-2);
}

textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  padding: 17px;
  border: 1px solid rgba(168, 85, 247, 0.24);
  border-radius: 14px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(4, 2, 10, 0.88), rgba(9, 4, 18, 0.9)),
    radial-gradient(circle at top right, rgba(168, 85, 247, 0.08), transparent 20rem);
  outline: none;
  line-height: 1.62;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.96rem;
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.26);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition), opacity var(--transition);
}

textarea::placeholder {
  color: rgba(184, 168, 217, 0.72);
}

textarea:focus {
  border-color: rgba(103, 232, 249, 0.68);
  box-shadow:
    inset 0 0 34px rgba(0, 0, 0, 0.25),
    0 0 0 4px rgba(103, 232, 249, 0.08),
    0 0 28px rgba(103, 232, 249, 0.12);
}

textarea[readonly] {
  color: #faf7ff;
}

.counter {
  font-size: 0.78rem;
  font-weight: 750;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action-button {
  position: relative;
  min-height: 48px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  overflow: hidden;
  font-weight: 900;
}

.action-button::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.22), transparent 55%);
  transition: opacity var(--transition);
}

.action-button:hover::before {
  opacity: 1;
}

.action-button.primary {
  border-color: rgba(192, 132, 252, 0.82);
  background: linear-gradient(135deg, #8b5cf6, #a855f7 52%, #7c3aed);
  box-shadow: 0 16px 36px rgba(168, 85, 247, 0.28);
}

.action-button.primary:hover {
  box-shadow: 0 20px 44px rgba(168, 85, 247, 0.36), 0 0 24px rgba(103, 232, 249, 0.1);
}

.action-button.secondary:hover .swap-icon {
  transform: rotate(180deg);
}

.action-button.danger {
  border-color: rgba(251, 113, 133, 0.26);
}

.action-button.danger:hover {
  border-color: rgba(251, 113, 133, 0.64);
  box-shadow: 0 0 28px rgba(251, 113, 133, 0.13);
}

.action-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button-icon,
.button-text {
  position: relative;
  z-index: 1;
}

.button-icon {
  font-size: 1.15rem;
  line-height: 1;
  transition: transform var(--transition);
}

.toast-container {
  position: fixed;
  z-index: 5;
  top: 22px;
  right: 22px;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: min(320px, calc(100vw - 32px));
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(103, 232, 249, 0.32);
  border-radius: 15px;
  color: var(--text);
  background: rgba(10, 5, 21, 0.82);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38), 0 0 28px rgba(103, 232, 249, 0.1);
  backdrop-filter: blur(18px);
  animation: toastIn 220ms var(--transition) both, toastOut 260ms var(--transition) 1650ms forwards;
  font-weight: 850;
}

.toast-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #04120a;
  background: linear-gradient(135deg, var(--success), var(--accent-2));
  font-size: 0.85rem;
  font-weight: 950;
}

.toast.error {
  border-color: rgba(251, 113, 133, 0.44);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38), 0 0 28px rgba(251, 113, 133, 0.14);
}

.toast.error .toast-icon {
  color: #2a050b;
  background: linear-gradient(135deg, var(--danger), #fda4af);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 20px, 760px);
    padding: 12px 0 20px;
  }

  .hero-card {
    align-items: center;
  }

  .converter-layout {
    grid-template-columns: 1fr;
  }

  .gui-layout {
    grid-template-columns: 1fr;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .preview-card {
    margin-top: 0;
  }
}

@media (max-width: 1250px) {
  .gui-editor-layout {
    grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
  }

  .paint-panel {
    grid-column: 1 / -1;
    min-height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .paint-panel .panel-head,
  .paint-panel .tool-info-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .gui-shell {
    width: min(100% - 20px, 760px);
  }

  .gui-side-panel,
  .premium-preview {
    min-height: auto;
  }

  .premium-preview {
    order: -1;
  }

  .paint-panel {
    grid-template-columns: 1fr;
  }

  .editor-canvas-stage {
    min-height: 360px;
  }
}

@media (max-width: 700px) {
  .editor-grid {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 260px;
  }

  .canvas-stage {
    min-height: 320px;
    padding: 14px;
  }

  .workspace-head {
    flex-direction: column;
  }

}

@media (max-width: 520px) {
  .hero-card,
  .control-panel,
  .workspace {
    border-radius: 16px;
  }

  .hero-card {
    padding: 14px;
  }

  .brand {
    align-items: center;
    gap: 10px;
  }

  .brand-logo {
    width: 56px;
    height: 56px;
  }

  h1 {
    font-size: clamp(1.55rem, 8vw, 2.15rem);
    line-height: 1.18;
  }

  .mode-option {
    grid-template-columns: 38px 1fr auto;
  }

  .mode-icon {
    width: 38px;
    height: 38px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toast-container {
    top: auto;
    right: 10px;
    bottom: 14px;
    left: 10px;
  }

  .home-intro,
  .tool-card {
    padding: 16px;
  }

  .tool-card {
    min-height: 230px;
  }
}
