:root {
  --bg0: #2aa4db;
  --bg1: #2aa4db;
  --card: rgba(255, 255, 255, 0.08);
  --card2: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.18);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);

  --hero: #ff1e1e;
  --heroText: #ffffff;
  --panel: rgba(255, 255, 255, 0.14);
  --cardWhite: #ffffff;
  --ink: #0b1220;

  --adsTopH: 0px;
  --adsBottomH: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  padding-top: var(--adsTopH);
  padding-bottom: var(--adsBottomH);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial,
    "Noto Sans", "Liberation Sans", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg0), var(--bg1));
}

.is-drawer-open {
  overflow: hidden;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}

.drawer.is-open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
}

.drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: min(420px, 92vw);
  background: rgba(255, 255, 255, 0.96);
  color: #0b1220;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  display: grid;
  grid-template-rows: auto 1fr;
  transform: translateX(-12px);
  animation: drawerIn 180ms ease forwards;
}

@keyframes drawerIn {
  from {
    opacity: 0.9;
    transform: translateX(-18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.drawer-head {
  padding: 16px 16px 12px;
  background: #ff1e1e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-title {
  font-weight: 950;
  letter-spacing: 0.4px;
}

.drawer-body {
  padding: 14px 16px 16px;
}

.drawer-body .input {
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.18);
  color: #0b1220;
  border-radius: 10px;
}

.drawer-body .input::placeholder {
  color: rgba(11, 18, 32, 0.55);
}

.cat-list {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.cat-row {
  appearance: none;
  border: 0;
  width: 100%;
  padding: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.cat-name {
  font-size: 16px;
  color: rgba(0, 0, 0, 0.82);
}

.cat-badge {
  min-width: 34px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
  background: #2aa4db;
}

/* Trending */
.trending {
  margin: 10px 0 14px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.trending-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.trending-title {
  font-size: 16px;
  font-weight: 950;
}

.trending-sub {
  font-size: 12px;
  color: var(--muted);
}

.trending-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.trending-grid::-webkit-scrollbar {
  height: 0;
}

.trend-card {
  scroll-snap-align: start;
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform 120ms ease;
}

.trend-card:hover {
  transform: translateY(-1px);
}

.trend-thumb {
  aspect-ratio: 4 / 3;
  background: #f4f7fb;
  display: grid;
  place-items: center;
}

.trend-thumb img,
.trend-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.trend-body {
  padding: 10px 10px 12px;
}

.trend-title {
  font-size: 13px;
  font-weight: 850;
  color: var(--ink);
  line-height: 1.2;
}

.trend-meta {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(11, 18, 32, 0.62);
}

@media (max-width: 720px) {
  .trending-grid {
    grid-template-columns: repeat(5, minmax(160px, 1fr));
  }
}

.ads-fixed {
  position: fixed;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 999;
  pointer-events: none;
}

.ads-fixed > .ads-inner {
  pointer-events: auto;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.ads-top {
  top: 8px;
}

.ads-bottom {
  bottom: 8px;
}

.ads-inline {
  margin: 14px 0 10px;
  display: flex;
  justify-content: center;
}

.ads-inline .ads-inner {
  padding: 8px 10px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 18px 44px;
}

.hero {
  background: var(--hero);
  color: var(--heroText);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.16);
  margin-bottom: 14px;
}

.hero-bar {
  display: grid;
  grid-template-columns: 170px 1fr 360px;
  gap: 12px;
  align-items: center;
  padding: 14px 14px 10px;
}

.hero-title {
  text-align: center;
  font-weight: 900;
  letter-spacing: 0.5px;
  font-size: 56px;
  line-height: 0.95;
  text-transform: lowercase;
}

.hero-home {
  cursor: pointer;
  user-select: none;
}

.hero-home:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.55);
  outline-offset: 6px;
  border-radius: 14px;
}

.hero-sub {
  text-align: center;
  font-size: 26px;
  font-weight: 780;
  padding: 8px 14px 14px;
  background: rgba(0, 0, 0, 0.08);
}

.crumb {
  padding: 10px 14px 14px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
}

.btn.cat {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-weight: 850;
}

.hero-search {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 10px;
  align-items: center;
}

.input.search {
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  border: 0;
}

.hero .input::placeholder {
  color: rgba(11, 18, 32, 0.5);
}

.search-btn {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hud-item {
  min-width: 0;
}

.hud-paint {
  flex-wrap: wrap;
  max-width: 100%;
}

.hud-paint > * {
  max-width: 100%;
}

.hud-desenho {
  min-width: 220px;
  flex: 1 1 260px;
}

.btn.back {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.is-paint .hero-bar,
.is-paint .hero-sub,
.is-paint .crumb {
  display: none !important;
}

.is-paint .hero {
  margin-bottom: 10px;
}

.hud-paint {
  margin-bottom: 12px;
}

.hud-item {
  display: grid;
  gap: 2px;
  min-width: 105px;
}

.hud-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.hud-value {
  font-size: 13px;
  font-weight: 650;
}

.btn {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.18);
}

.btn:active {
  transform: translateY(0);
  opacity: 0.92;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.btn.icon {
  padding: 10px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.btn.icon svg {
  display: block;
}

.paleta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 14px 0 16px;
}

.paletas {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* Carousel palette (pencils) */
.paleta.carousel {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 12px;
  margin: 12px 0 10px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.paleta.carousel::-webkit-scrollbar {
  height: 0;
}

.paleta.carousel {
  scrollbar-width: none;
}

.paleta.carousel.is-dragging {
  cursor: grabbing;
}

#livrePaleta.pencil-carousel {
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.14));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.pencil-swatch {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  width: 44px;
  height: 150px;
  display: grid;
  place-items: end center;
  scroll-snap-align: start;
  cursor: pointer;
}

.pencil-swatch:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.55);
  outline-offset: 4px;
  border-radius: 12px;
}

.pencil {
  position: relative;
  width: 22px;
  height: 126px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 18%, var(--c) 18%, var(--c) 100%);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.18), inset 0 -22px 0 rgba(0, 0, 0, 0.16);
}

.pencil-swatch .pencil {
  transition: transform 140ms ease, filter 140ms ease;
}

.pencil-swatch:hover .pencil {
  transform: translateY(-6px);
  filter: saturate(1.05);
}

.pencil-swatch.is-active .pencil {
  transform: translateY(-8px);
  filter: saturate(1.08) brightness(1.02);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.22), inset 0 -22px 0 rgba(0, 0, 0, 0.16), 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.pencil-swatch.is-active .pencil-badge {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.2);
}

/* Wooden tip */
.pencil::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 18px solid #f0d2ad;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.18));
}

/* Graphite point */
.pencil::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 15, 15, 0.9);
}

/* Eraser */
.pencil-swatch .pencil {
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.18), inset 0 -22px 0 rgba(232, 232, 238, 0.92), inset 0 -28px 0 rgba(0, 0, 0, 0.14);
}

.pencil-num {
  position: relative;
}

.pencil-badge {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.75);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.swatch.swatch-free .n {
  display: none;
}

.swatch.swatch-free {
  grid-template-columns: 18px 1fr;
}

.swatch.swatch-free .name {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 170px 220px 1fr;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin: 14px 0 8px;
}

.toolset {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.tool {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.tool:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.tool.is-active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.42);
}

.field.compact .input {
  padding: 10px 12px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  user-select: none;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.swatch {
  display: grid;
  grid-template-columns: 18px 32px 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--text);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.swatch:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
}

.swatch.is-active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.chip {
  width: 16px;
  height: 16px;
  border-radius: 6px;
  background: var(--c);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

.swatch .n {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.22);
  font-weight: 800;
}

.swatch .name {
  font-size: 13px;
  color: var(--muted);
  text-align: left;
}

.canvas-wrap {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.gallery {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.16);
}

.gallery-top {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.card {
  border-radius: 16px;
  border: 0;
  background: var(--cardWhite);
  overflow: hidden;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.card:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.3);
}

.thumb {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: #f4f7fb;
}

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

.thumb svg {
  width: 100%;
  height: 100%;
  display: block;
}

.card-body {
  padding: 10px 10px 12px;
}

.card-no-body .card-body {
  display: none;
}

.card-drawing .thumb {
  aspect-ratio: 1 / 1;
}

.card-title {
  font-size: 13px;
  font-weight: 780;
  line-height: 1.2;
  color: var(--ink);
}

.card-meta {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(11, 18, 32, 0.65);
}

.stage {
  position: relative;
  width: min(520px, 100%);
  margin: 0 auto;
}

.overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  touch-action: none;
}

.canvas {
  width: min(520px, 100%);
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.22));
}

.area {
  fill: rgba(255, 255, 255, 0.82);
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 2;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, fill 120ms ease;
}

.area:hover {
  filter: brightness(0.98);
}

.area.is-wrong {
  animation: shake 220ms linear;
}

.num {
  font-size: 22px;
  font-weight: 800;
  fill: rgba(0, 0, 0, 0.5);
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 4;
  pointer-events: none;
  user-select: none;
}

.hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.h2 {
  margin: 0 0 12px;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
}

.input,
.textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  padding: 12px 12px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.input[type="file"] {
  padding: 10px 12px;
}

select.input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.65) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.65) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.35;
}

.input::placeholder,
.textarea::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.span-2 {
  grid-column: span 2;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

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

.row {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}

.row-title {
  font-weight: 750;
  font-size: 13px;
}

.row-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn.danger {
  background: rgba(226, 75, 59, 0.18);
  border: 1px solid rgba(226, 75, 59, 0.35);
}

.btn.danger:hover {
  background: rgba(226, 75, 59, 0.24);
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-3px);
  }
  40% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-2px);
  }
  80% {
    transform: translateX(2px);
  }
  100% {
    transform: translateX(0);
  }
}

@media (max-width: 720px) {
  .hero-bar {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 44px;
  }

  .hud {
    justify-content: space-between;
  }

  .hud-paint {
    gap: 10px;
  }

  .hud-desenho {
    min-width: 0;
    flex: 1 1 320px;
  }

  /* Prevent the select from forcing horizontal overflow on mobile */
  .hud-desenho .input {
    width: 100%;
    max-width: 100%;
  }

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

  .toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
  }

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

  .gallery-top {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 520px) {
  .is-paint .hero {
    display: none !important;
  }

  .hud-paint {
    padding: 12px;
    border-radius: 18px;
    justify-content: flex-start;
  }

  #voltarPack {
    order: 0;
  }

  .hud-paint .hud-desenho {
    order: 1;
    flex: 1 1 calc(100% - 56px);
  }

  /* Make "Selecionado" and "Progresso" fit and not push everything sideways */
  .hud-paint .hud-item:not(.hud-desenho) {
    flex: 1 1 140px;
  }

  .hud-paint .hud-desenho .input {
    border-radius: 18px;
  }

  .hud-paint .hud-item {
    min-width: 120px;
  }

  #imprimir,
  #limpar,
  #baixar,
  #compartilhar {
    order: 4;
  }
  #imprimir,
  #limpar {
    padding: 10px 12px;
    font-size: 12px;
    border-radius: 14px;
  }

  .pencil-swatch {
    width: 40px;
    height: 128px;
  }

  .pencil {
    width: 20px;
    height: 104px;
  }

  .pencil-badge {
    bottom: 8px;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .paleta,
  .toolbar,
  .hud,
  .hint {
    display: none !important;
  }

  .canvas-wrap {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .area {
    stroke: #000;
    fill: #fff;
  }

  .num {
    fill: #000;
    stroke: transparent;
  }
}

/* =========================
   Admin (material-like)
   ========================= */

body.admin {
  padding-top: 0;
  padding-bottom: 0;
  background: #efefef;
  color: #222;
}

.admin .app,
.admin .hero,
.admin .ads-fixed {
  display: none;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
}

.admin-sidebar {
  background: #ffffff;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 14px;
}

.admin-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(76, 175, 80, 0.12);
  color: #2e7d32;
}

.admin-user {
  font-weight: 800;
  font-size: 13px;
  line-height: 1.1;
}

.admin-email {
  margin-top: 3px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
}

.admin-menu-title {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: rgba(0, 0, 0, 0.5);
  background: rgba(0, 0, 0, 0.035);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.admin-menu {
  display: grid;
  gap: 2px;
  padding: 10px 10px 16px;
}

.admin-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: rgba(0, 0, 0, 0.78);
  font-weight: 650;
}

.admin-link:hover {
  background: rgba(0, 0, 0, 0.045);
}

.admin-link.is-active {
  background: rgba(76, 175, 80, 0.12);
  color: #2e7d32;
}

.admin-sidebar-footer {
  padding: 14px 16px 16px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.admin-small {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.5);
}

.admin-main {
  display: grid;
  grid-template-rows: 56px 1fr;
  min-width: 0;
}

.admin-topbar {
  background: #4caf50;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-crumb {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.admin-content {
  padding: 22px 22px 40px;
}

.admin-alert {
  display: none;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff3cd;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.75);
}

.admin-card {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 18px 18px 16px;
  max-width: 980px;
}

.admin-view {
  display: none;
}

.admin-breadcrumb {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.5);
  margin-bottom: 10px;
}

.admin-card-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.3px;
}

.admin-card-sub {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.65);
}

.admin-form {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.admin-field {
  display: grid;
  gap: 8px;
}

.admin-span-2 {
  grid-column: span 2;
}

.admin-label {
  font-size: 12px;
  font-weight: 750;
  color: rgba(0, 0, 0, 0.6);
}

.admin .input,
.admin .textarea {
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  color: rgba(0, 0, 0, 0.85);
  box-shadow: none;
}

.admin .input::placeholder,
.admin .textarea::placeholder {
  color: rgba(0, 0, 0, 0.38);
}

.admin-file {
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  padding: 10px 12px;
  color: rgba(0, 0, 0, 0.75);
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.6);
}

.admin .btn {
  background: #4caf50;
  color: #fff;
  border: 0;
  border-radius: 22px;
  padding: 10px 14px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(76, 175, 80, 0.22);
}

.admin .btn:hover {
  background: #43a047;
  transform: translateY(-1px);
}

.admin .btn.ghost {
  background: #ffffff;
  color: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.06);
}

.admin .btn.ghost:hover {
  background: rgba(0, 0, 0, 0.03);
}

.admin .btn.danger {
  background: #ffffff;
  color: #c62828;
  border: 1px solid rgba(198, 40, 40, 0.3);
  box-shadow: 0 10px 22px rgba(198, 40, 40, 0.06);
}

.admin .btn.danger:hover {
  background: rgba(198, 40, 40, 0.06);
}

.admin-top-actions .btn {
  padding: 9px 12px;
  border-radius: 18px;
}

.admin-drop {
  margin-top: 10px;
  border: 2px dashed rgba(0, 0, 0, 0.18);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.02);
  padding: 18px;
  min-height: 160px;
  position: relative;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.admin-drop.is-drag {
  border-color: rgba(76, 175, 80, 0.65);
  background: rgba(76, 175, 80, 0.06);
  transform: translateY(-1px);
}

.admin-drop-inner {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  color: rgba(0, 0, 0, 0.55);
  text-align: center;
}

.admin-drop-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.03);
  color: rgba(0, 0, 0, 0.55);
}

.admin-drop-title {
  font-weight: 800;
  color: rgba(0, 0, 0, 0.58);
}

.admin-drop-preview {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.admin-fab-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.admin-fab-row .btn {
  border-radius: 999px;
  padding: 12px 18px;
}

.admin-empty {
  padding: 16px;
  border-radius: 10px;
  border: 1px dashed rgba(0, 0, 0, 0.18);
  color: rgba(0, 0, 0, 0.58);
  background: rgba(255, 255, 255, 0.8);
}

.admin-item {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.015);
}

.admin-item-thumb {
  width: 72px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.admin-item-thumb img,
.admin-item-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-item + .admin-item {
  margin-top: 10px;
}

.admin-item-title {
  font-weight: 900;
}

.admin-item-meta {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
}

.admin-batch {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.015);
  display: none;
}

.admin-batch-title {
  font-weight: 900;
  margin-bottom: 8px;
}

.admin-batch-list {
  display: grid;
  gap: 6px;
  max-height: 210px;
  overflow: auto;
  padding-right: 4px;
}

.admin-batch-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.7);
}

.admin-batch-row .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-batch-row .st {
  font-weight: 800;
  color: rgba(0, 0, 0, 0.55);
}

.admin-batch-row.is-ok .st {
  color: #2e7d32;
}

.admin-batch-row.is-bad .st {
  color: #c62828;
}

.admin-pack {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.015);
}

.admin-pack + .admin-pack {
  margin-top: 10px;
}

.admin-pack-cover {
  width: 84px;
  height: 62px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.admin-pack-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-pack-name {
  font-weight: 900;
}

.admin-pack-meta {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
}

@media (max-width: 920px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    grid-template-rows: auto auto auto auto;
    border-right: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }
  .admin-form {
    grid-template-columns: 1fr;
  }
  .admin-span-2 {
    grid-column: auto;
  }
  .admin-content {
    padding: 16px 14px 30px;
  }
  .admin-pack {
    grid-template-columns: 70px 1fr auto;
  }
  .admin-pack-cover {
    width: 70px;
    height: 56px;
  }
}
