:root {
  color-scheme: light;
  --ink: #16324a;
  --muted-ink: #52687a;
  --navy: #23496a;
  --navy-dark: #173852;
  --sky: #e7f3f8;
  --mint: #65d4bb;
  --mint-soft: #e3f8f2;
  --sun: #ffd55f;
  --sun-soft: #fff5ce;
  --coral: #ff7b70;
  --coral-dark: #b8403b;
  --paper: #ffffff;
  --page: #eef7f4;
  --line: #c8dce2;
  --shadow: 0 12px 28px rgba(24, 66, 89, 0.12);
  --active-color: #2589d8;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 3%, rgba(101, 212, 187, 0.18), transparent 24rem),
    radial-gradient(circle at 94% 12%, rgba(255, 213, 95, 0.18), transparent 22rem),
    var(--page);
}

button,
input,
label {
  font: inherit;
}

button,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
label[for]:focus-within,
input:focus-visible,
canvas:focus-visible,
[role="radio"]:focus-visible {
  outline: 4px solid var(--sun);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 12px 18px;
  color: #fff;
  background: var(--navy-dark);
  border-radius: 10px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.icon-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-large {
  width: 32px;
  height: 32px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding: 14px clamp(18px, 4vw, 56px);
  color: #fff;
  background: var(--navy);
  border-bottom: 6px solid var(--sun);
}

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

.brand-mark {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  color: var(--navy);
  background: #fff;
  border: 4px solid rgba(255, 255, 255, 0.38);
  border-radius: 19px;
  box-shadow: 0 5px 0 rgba(10, 37, 55, 0.22);
}

.brand-mark span {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.brand-mark .dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.dot-one {
  top: 6px;
  right: 6px;
  background: var(--coral);
}

.dot-two {
  right: 5px;
  bottom: 8px;
  background: var(--mint);
}

.dot-three {
  bottom: 5px;
  left: 7px;
  background: var(--sun);
}

.brand-kicker,
.step-label {
  margin: 0 0 2px;
  font-family: Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-kicker {
  color: #ccecf0;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.3rem);
  line-height: 1;
  letter-spacing: 0.01em;
}

.sound-toggle {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 15px;
  cursor: pointer;
}

.sound-toggle[aria-pressed="true"] {
  color: var(--navy-dark);
  background: var(--sun);
  border-color: var(--sun);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  gap: clamp(18px, 2.6vw, 36px);
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 40px);
}

.chooser,
.studio {
  min-width: 0;
}

.chooser {
  align-self: start;
  padding: 22px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-heading h2,
.gallery-title-row h3 {
  margin: 0;
  color: var(--ink);
  line-height: 1.15;
}

.step-heading h2 {
  font-size: clamp(1.28rem, 2.4vw, 1.65rem);
}

.step-label {
  color: #587487;
  font-size: 0.72rem;
}

.step-number {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  color: var(--navy-dark);
  background: var(--sun);
  border: 3px solid var(--navy-dark);
  border-radius: 16px;
  font-size: 1.3rem;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(35, 73, 106, 0.2);
}

.step-two {
  color: #fff;
  background: var(--navy);
}

.step-three {
  color: var(--navy-dark);
  background: var(--mint);
}

.upload-button,
.blank-button,
.save-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 64px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.upload-button {
  margin-top: 22px;
  padding: 13px 15px;
  color: var(--navy-dark);
  background: var(--sun);
  border: 3px solid var(--navy-dark);
  box-shadow: 0 5px 0 var(--navy-dark);
}

.upload-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--navy-dark);
}

.upload-button span,
.save-button span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.upload-button strong,
.save-button strong {
  font-size: 1.06rem;
}

.upload-button small,
.save-button small {
  margin-top: 4px;
  font-family: Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
}

.blank-button {
  margin-top: 14px;
  padding: 12px 15px;
  color: var(--navy);
  background: #fff;
  border: 2px solid #9ebac7;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 16px 2px 20px;
  color: var(--muted-ink);
  font-family: Arial, sans-serif;
  font-size: 0.82rem;
  line-height: 1.35;
}

.mini-check {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: #18755e;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 2px dashed #cddfe4;
}

.gallery-title-row h3 {
  font-size: 1.05rem;
}

#galleryCount {
  color: var(--muted-ink);
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
}

.drawing-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 360px;
  margin-top: 12px;
  overflow: auto;
  overscroll-behavior: contain;
}

.empty-gallery {
  grid-column: 1 / -1;
  display: flex;
  min-height: 142px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  color: #647c8a;
  text-align: center;
  background: #f4f9fa;
  border: 2px dashed #bdd3da;
  border-radius: 15px;
}

.empty-gallery p {
  max-width: 190px;
  margin: 0;
  font-family: Arial, sans-serif;
  font-size: 0.86rem;
  line-height: 1.35;
}

.empty-icon {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-item {
  position: relative;
  min-height: 112px;
  padding: 6px;
  overflow: hidden;
  color: var(--ink);
  background: #f7fbfc;
  border: 3px solid transparent;
  border-radius: 14px;
  cursor: pointer;
}

.gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
  border-radius: 9px;
}

.gallery-item span {
  display: block;
  padding: 7px 3px 3px;
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-item.is-selected {
  background: var(--sun-soft);
  border-color: var(--navy);
}

.studio {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.studio-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-action {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 12px;
  color: var(--navy);
  background: #fff;
  border: 2px solid #b5cbd3;
  border-radius: 13px;
  cursor: pointer;
}

.icon-action span {
  font-family: Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
}

.danger-soft {
  color: var(--coral-dark);
  border-color: #efb0ac;
}

.tool-panel {
  display: grid;
  grid-template-columns: minmax(330px, 1.25fr) minmax(290px, 1fr);
  gap: 16px;
  padding: 15px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 7px 18px rgba(24, 66, 89, 0.08);
}

.tool-group {
  min-width: 0;
}

.control-label {
  display: block;
  margin: 0 0 8px 3px;
  color: var(--muted-ink);
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.segmented-tools,
.size-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.tool-button,
.size-button {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--navy);
  background: #f3f8fa;
  border: 2px solid transparent;
  border-radius: 13px;
  cursor: pointer;
}

.tool-button span,
.size-button span:last-child {
  font-family: Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
}

.tool-button.is-selected,
.size-button.is-selected {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy-dark);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16);
}

.size-button {
  flex-direction: column;
  gap: 5px;
}

.size-dot {
  display: block;
  border-radius: 999px;
  background: currentColor;
}

.small-dot {
  width: 8px;
  height: 8px;
}

.medium-dot {
  width: 15px;
  height: 15px;
}

.large-dot {
  width: 23px;
  height: 23px;
}

.canvas-card {
  position: relative;
  padding: 13px;
  overflow: hidden;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.canvas-card::before {
  position: absolute;
  z-index: 2;
  top: 54px;
  bottom: 55px;
  left: 0;
  width: 8px;
  content: "";
  background: var(--active-color);
  border-radius: 0 8px 8px 0;
}

.canvas-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 0 6px 10px;
  font-family: Arial, sans-serif;
  font-size: 0.84rem;
  font-weight: 800;
}

.current-drawing {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.current-drawing span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  background: var(--mint);
  border: 2px solid #27715f;
  border-radius: 999px;
}

.active-tool {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: var(--navy);
  background: var(--sky);
  border-radius: 9px;
}

.canvas-frame {
  position: relative;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  touch-action: none;
  background: #fff;
  border: 3px solid var(--navy);
  border-radius: 17px;
  box-shadow: inset 0 0 0 5px #eef5f6;
}

.canvas-frame canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#outlineCanvas {
  z-index: 2;
  pointer-events: none;
}

#paintCanvas {
  z-index: 1;
  cursor: crosshair;
  touch-action: none;
}

.canvas-frame[data-tool="fill"] #paintCanvas {
  cursor: cell;
}

.canvas-frame[data-tool="eraser"] #paintCanvas {
  cursor: not-allowed;
}

.processing-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--navy-dark);
  background: rgba(255, 255, 255, 0.94);
}

.processing-overlay[hidden] {
  display: none;
}

.processing-overlay strong {
  margin-top: 15px;
  font-size: 1.15rem;
}

.processing-overlay span {
  margin-top: 5px;
  color: var(--muted-ink);
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 6px solid #dcebed;
  border-top-color: var(--coral);
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

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

.canvas-message {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 8px 0;
  color: #405f71;
  text-align: center;
}

.canvas-message p {
  margin: 0;
  font-family: Arial, sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
}

.message-icon {
  color: #bf7d00;
  font-size: 1.25rem;
}

.palette-save-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(205px, 240px);
  gap: 16px;
  align-items: stretch;
}

.palette-section {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  min-width: 0;
  padding: 14px 17px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 7px 18px rgba(24, 66, 89, 0.08);
}

.palette-heading {
  min-width: 190px;
}

.palette-heading h2 {
  font-size: 1.15rem;
}

.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.color-button,
.custom-color-label {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 15px;
  box-shadow: 0 0 0 2px #adc2ca, 0 3px 0 rgba(35, 73, 106, 0.18);
  cursor: pointer;
}

.color-button.is-selected {
  box-shadow: 0 0 0 4px var(--navy), 0 4px 0 rgba(35, 73, 106, 0.18);
  transform: translateY(-2px);
}

.color-button .icon {
  display: none;
  width: 26px;
  height: 26px;
  color: #fff;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55));
  stroke-width: 3.5;
}

.color-button.is-selected .icon {
  display: block;
}

.custom-color-label {
  overflow: hidden;
  color: var(--navy-dark);
  background: conic-gradient(#f44336, #ffcc33, #43c463, #2f8fe6, #8a5ce6, #f44336);
}

.custom-color-label::after {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  content: "+";
  color: var(--navy-dark);
  background: #fff;
  border-radius: 9px;
  font-size: 1.35rem;
  font-weight: 900;
}

.custom-color-label input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.save-button {
  min-height: 92px;
  padding: 15px 18px;
  color: #fff;
  background: #16745f;
  border: 3px solid #0b4e40;
  box-shadow: 0 6px 0 #0b4e40;
}

.save-button:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #0b4e40;
}

.confirm-dialog {
  width: min(440px, calc(100% - 30px));
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(10, 37, 55, 0.3);
}

.confirm-dialog::backdrop {
  background: rgba(13, 40, 58, 0.58);
  backdrop-filter: blur(3px);
}

.confirm-dialog form {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px;
  text-align: center;
}

.dialog-icon {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  color: var(--coral-dark);
  background: #fff0ee;
  border-radius: 19px;
}

.dialog-icon .icon {
  width: 31px;
  height: 31px;
}

.confirm-dialog h2 {
  margin: 18px 0 8px;
  font-size: 1.45rem;
}

.confirm-dialog p {
  margin: 0;
  color: var(--muted-ink);
  font-family: Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin-top: 24px;
}

.dialog-actions button {
  min-height: 54px;
  padding: 10px 14px;
  border-radius: 14px;
  cursor: pointer;
}

.dialog-cancel {
  color: var(--navy);
  background: #fff;
  border: 2px solid #aac1ca;
}

.dialog-confirm {
  color: #fff;
  background: var(--coral-dark);
  border: 2px solid #8d2e2b;
}

@media (hover: hover) {
  .sound-toggle:hover,
  .blank-button:hover,
  .icon-action:hover:not(:disabled),
  .tool-button:hover,
  .size-button:hover {
    border-color: var(--navy);
  }

  .gallery-item:hover {
    background: var(--sun-soft);
  }

  .save-button:hover {
    background: #116650;
  }
}

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

  .chooser {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(230px, 1fr) minmax(250px, 1.3fr);
    gap: 12px 18px;
    align-items: center;
  }

  .chooser > .step-heading,
  .chooser > .privacy-note {
    grid-column: 1;
  }

  .upload-button {
    grid-column: 2;
    grid-row: 1;
    margin-top: 0;
  }

  .blank-button {
    grid-column: 2;
    grid-row: 2;
    margin-top: 0;
  }

  .gallery-title-row,
  .drawing-gallery {
    grid-column: 3;
  }

  .gallery-title-row {
    align-self: end;
    padding-top: 0;
    border-top: 0;
  }

  .drawing-gallery {
    grid-row: 2 / span 2;
    grid-template-columns: repeat(3, minmax(94px, 1fr));
    max-height: 170px;
    align-self: start;
    margin-top: 0;
  }

  .empty-gallery {
    min-height: 110px;
  }
}

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

  .chooser > .step-heading {
    grid-column: 1 / -1;
  }

  .upload-button {
    grid-column: 1;
    grid-row: 2;
  }

  .blank-button {
    grid-column: 2;
    grid-row: 2;
  }

  .chooser > .privacy-note {
    grid-column: 1 / -1;
    margin: 6px 2px;
  }

  .gallery-title-row,
  .drawing-gallery {
    grid-column: 1 / -1;
  }

  .gallery-title-row {
    grid-row: auto;
    padding-top: 12px;
    border-top: 2px dashed #cddfe4;
  }

  .drawing-gallery {
    grid-row: auto;
  }

  .studio-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-actions {
    width: 100%;
  }

  .icon-action {
    flex: 1;
  }

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

  .palette-save-row {
    grid-template-columns: 1fr;
  }

  .palette-section {
    grid-template-columns: 1fr;
  }

  .palette-heading {
    min-width: 0;
  }

  .save-button {
    min-height: 76px;
  }
}

@media (max-width: 600px) {
  .topbar {
    min-height: 80px;
    padding: 11px 14px;
    border-bottom-width: 5px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 16px;
  }

  .brand-mark span {
    font-size: 1.7rem;
  }

  .brand-kicker {
    display: none;
  }

  .sound-toggle {
    min-height: 48px;
    padding: 9px 11px;
  }

  .sound-toggle span {
    max-width: 70px;
    font-family: Arial, sans-serif;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.1;
  }

  .workspace {
    gap: 16px;
    padding: 14px;
  }

  .chooser {
    display: grid;
    padding: 17px;
    border-radius: 19px;
  }

  .upload-button,
  .blank-button {
    grid-column: 1 / -1;
  }

  .upload-button {
    grid-row: auto;
  }

  .blank-button {
    grid-row: auto;
  }

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

  .history-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .icon-action {
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 7px 4px;
  }

  .icon-action span {
    font-size: 0.72rem;
  }

  .tool-panel {
    padding: 11px;
  }

  .segmented-tools,
  .size-options {
    gap: 5px;
  }

  .tool-button,
  .size-button {
    min-height: 64px;
    flex-direction: column;
    gap: 4px;
    padding: 7px 3px;
  }

  .tool-button span,
  .size-button span:last-child {
    font-size: 0.72rem;
  }

  .canvas-card {
    padding: 9px;
    border-radius: 18px;
  }

  .canvas-card::before {
    top: 48px;
    bottom: 50px;
    width: 6px;
  }

  .canvas-topline {
    font-size: 0.74rem;
  }

  .active-tool {
    max-width: 52%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .canvas-frame {
    border-width: 2px;
    border-radius: 12px;
  }

  .canvas-message p {
    font-size: 0.8rem;
  }

  .palette-section {
    padding: 13px;
  }

  .color-palette {
    gap: 10px;
  }

  .color-button,
  .custom-color-label {
    width: 47px;
    height: 47px;
    flex-basis: 47px;
  }

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

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

  .spinner {
    animation: none;
    border-color: var(--coral);
  }
}

@media (forced-colors: active) {
  .color-button,
  .custom-color-label,
  .canvas-card::before {
    forced-color-adjust: none;
  }
}

/* Diseño compacto con navegación, lienzo centrado y panel de anuncios */
.topbar {
  min-height: 68px;
  padding: 7px clamp(16px, 3vw, 42px);
  border-bottom-width: 4px;
}

.brand {
  gap: 10px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-width: 3px;
  border-radius: 15px;
  box-shadow: 0 3px 0 rgba(10, 37, 55, 0.22);
}

.brand-mark span {
  font-size: 1.65rem;
}

.brand-mark .dot {
  width: 7px;
  height: 7px;
}

.brand-kicker {
  font-size: 0.68rem;
}

.brand h1 {
  font-size: clamp(1.48rem, 3vw, 1.8rem);
}

.sound-toggle {
  min-height: 44px;
  padding: 8px 13px;
  border-radius: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 250px;
  gap: 18px;
  width: min(1720px, 100%);
  padding: 18px clamp(16px, 2vw, 30px) 26px;
  align-items: start;
}

.left-sidebar {
  position: sticky;
  top: 84px;
  display: flex;
  max-height: calc(100vh - 100px);
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  overscroll-behavior: contain;
}

.activity-nav {
  padding: 7px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 7px 18px rgba(24, 66, 89, 0.08);
}

.activity-button {
  display: flex;
  width: 100%;
  min-height: 62px;
  align-items: center;
  gap: 12px;
  padding: 11px 15px;
  color: var(--navy);
  background: #f1f7f9;
  border: 2px solid transparent;
  border-radius: 13px;
  cursor: pointer;
}

.activity-button span {
  font-size: 1.05rem;
  font-weight: 900;
}

.activity-button.is-active {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy-dark);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.15);
}

.chooser {
  display: block;
  padding: 16px;
  border-radius: 19px;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  min-height: 32px;
}

.sidebar-heading h2 {
  margin: 0;
  font-size: 1.08rem;
}

.chooser .upload-button {
  min-height: 58px;
  margin-top: 13px;
  padding: 10px 11px;
  border-width: 2px;
  box-shadow: 0 4px 0 var(--navy-dark);
}

.chooser .upload-button .icon-large {
  width: 27px;
  height: 27px;
}

.chooser .upload-button strong {
  font-size: 0.94rem;
}

.chooser .upload-button small {
  font-size: 0.72rem;
}

.chooser .blank-button {
  min-height: 50px;
  margin-top: 11px;
}

.chooser .privacy-note {
  margin: 13px 2px 15px;
  font-size: 0.75rem;
}

.chooser .gallery-title-row {
  padding-top: 13px;
}

.chooser .drawing-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 230px;
}

.chooser .empty-gallery {
  min-height: 112px;
  padding: 12px;
}

.chooser .empty-gallery p {
  font-size: 0.77rem;
}

.studio {
  display: block;
  min-width: 0;
}

.paint-layout {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.vertical-toolbar {
  position: sticky;
  top: 84px;
  display: flex;
  max-height: calc(100vh - 100px);
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow: auto;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
}

.toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.vertical-toolbar .control-label {
  margin: 2px 0 3px;
  text-align: center;
  font-size: 0.68rem;
}

.vertical-toolbar .tool-button {
  display: flex;
  width: 100%;
  min-height: 60px;
  flex-direction: column;
  gap: 4px;
  padding: 7px 3px;
  border-radius: 12px;
}

.vertical-toolbar .tool-button .icon {
  width: 25px;
  height: 25px;
}

.vertical-toolbar .tool-button span {
  font-size: 0.68rem;
}

.vertical-toolbar .size-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.vertical-toolbar .size-button {
  display: flex;
  width: 100%;
  min-height: 43px;
  flex-direction: row;
  gap: 7px;
  padding: 5px;
  border-radius: 11px;
}

.vertical-toolbar .size-button span:last-child {
  font-size: 0.63rem;
}

.vertical-toolbar .small-dot {
  width: 7px;
  height: 7px;
}

.vertical-toolbar .medium-dot {
  width: 12px;
  height: 12px;
}

.vertical-toolbar .large-dot {
  width: 18px;
  height: 18px;
}

.toolbar-divider {
  height: 0;
  margin: 1px 3px;
  border-top: 2px dashed #cddfe4;
}

.vertical-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vertical-history .icon-action {
  display: flex;
  width: 100%;
  min-height: 45px;
  flex-direction: column;
  gap: 2px;
  padding: 5px 2px;
  border-radius: 11px;
}

.vertical-history .icon-action .icon {
  width: 20px;
  height: 20px;
}

.vertical-history .icon-action span {
  font-size: 0.61rem;
}

.canvas-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

.canvas-card {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.canvas-card::before {
  display: none;
}

.canvas-topline {
  width: min(100%, 960px);
  min-height: 36px;
  padding: 0 4px 8px;
}

.canvas-frame {
  margin-inline: auto;
  background: #fff;
  border: 4px solid var(--navy);
  border-radius: 18px;
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.9),
    0 16px 34px rgba(24, 66, 89, 0.18);
}

.canvas-message {
  width: min(100%, 960px);
  min-height: 34px;
  padding-top: 8px;
}

.palette-save-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 165px;
  gap: 12px;
  align-items: stretch;
}

.palette-section {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  padding: 10px 13px;
  border-radius: 17px;
}

.palette-section h2 {
  margin: 0;
  font-size: 1rem;
}

.color-palette {
  gap: 8px;
}

.color-button,
.custom-color-label {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border-radius: 13px;
}

.save-button {
  min-height: 66px;
  padding: 10px 12px;
  border-width: 2px;
  border-radius: 16px;
  box-shadow: 0 4px 0 #0b4e40;
}

.save-button strong {
  font-size: 0.93rem;
}

.save-button small {
  font-size: 0.7rem;
}

.ad-panel {
  position: sticky;
  top: 84px;
  padding: 15px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.ad-panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.ad-panel-heading h2 {
  margin: 0;
  font-size: 1.06rem;
}

.ad-panel-heading span {
  color: var(--muted-ink);
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
}

.ad-preview {
  position: relative;
  display: grid;
  width: 100%;
  max-height: 54vh;
  overflow: hidden;
  aspect-ratio: 3 / 5;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(101, 212, 187, 0.08), rgba(255, 213, 95, 0.12)),
    #f7fbfc;
  border: 2px dashed #adc9d3;
  border-radius: 15px;
}

.ad-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.ad-preview img[hidden] {
  display: none;
}

.ad-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  color: #698290;
  text-align: center;
}

.ad-placeholder[hidden] {
  display: none;
}

.ad-placeholder strong {
  color: var(--navy);
  font-size: 1rem;
}

.ad-placeholder span {
  font-family: Arial, sans-serif;
  font-size: 0.75rem;
}

.ad-upload-button,
.ad-remove-button {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 11px;
  padding: 9px 11px;
  border-radius: 13px;
  cursor: pointer;
}

.ad-upload-button {
  color: #fff;
  background: var(--navy);
  border: 2px solid var(--navy-dark);
}

.ad-remove-button {
  min-height: 42px;
  color: var(--coral-dark);
  background: #fff;
  border: 2px solid #efb0ac;
}

.ad-remove-button[hidden] {
  display: none;
}

.ad-note {
  margin: 9px 0 0;
  color: var(--muted-ink);
  text-align: center;
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
}

@media (hover: hover) {
  .activity-button:hover:not(.is-active),
  .ad-upload-button:hover {
    filter: brightness(1.06);
  }
}

@media (max-width: 1400px) {
  .workspace {
    grid-template-columns: 210px minmax(0, 1fr) 220px;
    gap: 14px;
    padding-inline: 14px;
  }

  .paint-layout {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 11px;
  }

  .vertical-toolbar {
    padding: 8px;
  }

  .vertical-toolbar .tool-button {
    min-height: 56px;
  }

  .color-button,
  .custom-color-label {
    width: 39px;
    height: 39px;
    flex-basis: 39px;
  }
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .ad-panel {
    position: static;
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: 170px minmax(220px, 1fr) 190px;
    gap: 14px;
    align-items: center;
  }

  .ad-panel-heading {
    display: block;
    margin: 0;
  }

  .ad-panel-heading span {
    display: block;
    margin-top: 5px;
  }

  .ad-preview {
    max-width: 340px;
    max-height: 220px;
    aspect-ratio: 16 / 9;
    justify-self: center;
  }

  .ad-upload-button,
  .ad-remove-button {
    margin-top: 0;
  }

  .ad-note {
    grid-column: 3;
    margin-top: -8px;
  }
}

@media (max-width: 820px) {
  .topbar {
    min-height: 62px;
    padding: 6px 12px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand-kicker {
    display: none;
  }

  .sound-toggle span {
    font-size: 0.76rem;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .left-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    max-height: none;
    overflow: visible;
  }

  .activity-nav {
    align-self: start;
  }

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

  .sidebar-heading,
  .chooser .privacy-note,
  .chooser .gallery-title-row,
  .chooser .drawing-gallery {
    grid-column: 1 / -1;
  }

  .chooser .upload-button,
  .chooser .blank-button {
    grid-column: auto;
    grid-row: auto;
    margin-top: 0;
  }

  .chooser .privacy-note {
    margin: 3px 2px;
  }

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

  .vertical-toolbar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    max-height: none;
    overflow: visible;
  }

  .vertical-toolbar .toolbar-group {
    min-width: 0;
  }

  .vertical-toolbar .toolbar-group:first-child,
  .vertical-toolbar .size-options,
  .vertical-history {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .vertical-toolbar .tool-button,
  .vertical-toolbar .size-button,
  .vertical-history .icon-action {
    min-height: 55px;
  }

  .vertical-toolbar .size-button {
    flex-direction: column;
  }

  .vertical-history {
    grid-column: 1 / -1;
  }

  .toolbar-divider {
    display: none;
  }

  .ad-panel {
    grid-column: 1;
  }
}

@media (max-width: 600px) {
  .brand h1 {
    font-size: 1.4rem;
  }

  .sound-toggle {
    min-height: 42px;
  }

  .left-sidebar {
    display: flex;
  }

  .activity-button {
    min-height: 54px;
  }

  .chooser {
    display: grid;
  }

  .chooser .upload-button,
  .chooser .blank-button {
    grid-column: 1 / -1;
  }

  .vertical-toolbar {
    grid-template-columns: 1fr;
  }

  .vertical-history {
    grid-column: 1;
  }

  .palette-save-row {
    grid-template-columns: 1fr;
  }

  .palette-section {
    grid-template-columns: 1fr;
  }

  .save-button {
    min-height: 60px;
  }

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

  .ad-preview {
    width: min(100%, 280px);
    max-height: 360px;
    aspect-ratio: 3 / 4;
  }

  .ad-note {
    grid-column: 1;
    margin-top: 0;
  }
}

/* V4: pantalla de trabajo ajustada, herramientas debajo y anuncio reservado */
.topbar {
  height: 60px;
  min-height: 60px;
  padding: 5px 0.5cm;
  border-bottom-width: 3px;
}

.brand {
  gap: 9px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-width: 2px;
  border-radius: 13px;
}

.brand-mark span {
  font-size: 1.5rem;
}

.brand-kicker {
  font-size: 0.62rem;
}

.brand h1 {
  font-size: 1.55rem;
}

.sound-toggle {
  min-height: 40px;
  padding: 6px 12px;
}

.workspace {
  display: grid;
  width: 100%;
  height: calc(100vh - 60px);
  grid-template-columns: clamp(215px, 15vw, 250px) minmax(0, 1fr) clamp(180px, 13vw, 230px);
  gap: 0.35cm;
  align-items: stretch;
  margin: 0;
  padding: 0.25cm 0.5cm;
  overflow: hidden;
}

.left-sidebar {
  position: static;
  display: flex;
  min-width: 0;
  min-height: 0;
  max-height: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow: hidden;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 7px 18px rgba(24, 66, 89, 0.08);
}

.activity-nav {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.activity-list-title {
  margin: 0 3px 3px;
  color: var(--muted-ink);
  font-family: Arial, sans-serif;
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.activity-button {
  min-height: 48px;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 11px;
}

.activity-button .icon-large {
  width: 25px;
  height: 25px;
}

.activity-button > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  font-size: 0.9rem;
  line-height: 1.05;
}

.activity-button small {
  margin-top: 3px;
  font-family: Arial, sans-serif;
  font-size: 0.56rem;
  font-weight: 700;
}

.activity-button.is-future {
  color: #607886;
  opacity: 1;
  background: #f4f8f9;
  border-color: #e2ecef;
}

.activity-button.is-future small {
  color: #7d909b;
}

.category-divider {
  flex: 0 0 auto;
  height: 0;
  margin: 1px 0;
  border-top: 2px dashed #ccdee3;
}

.chooser {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  align-self: stretch;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.sidebar-heading {
  min-height: 24px;
}

.sidebar-heading h2 {
  font-size: 0.95rem;
}

.chooser .upload-button {
  min-height: 52px;
  margin-top: 7px;
  padding: 7px 9px;
}

.chooser .blank-button {
  min-height: 42px;
  margin-top: 8px;
  padding: 7px 9px;
}

.chooser .privacy-note {
  margin: 8px 2px 9px;
  font-size: 0.68rem;
}

.chooser .gallery-title-row {
  flex: 0 0 auto;
  padding-top: 8px;
}

.chooser .gallery-title-row h3 {
  margin: 5px 0;
  font-size: 0.9rem;
}

.chooser .drawing-gallery {
  display: grid;
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  margin-top: 5px;
  overflow: auto;
  scrollbar-width: none;
}

.chooser .drawing-gallery::-webkit-scrollbar {
  display: none;
}

.chooser .empty-gallery {
  min-height: 90px;
  padding: 9px;
}

.chooser .empty-gallery p {
  font-size: 0.69rem;
}

.studio {
  display: block;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.paint-layout {
  display: flex;
  min-width: 0;
  min-height: 0;
  height: 100%;
  flex-direction: column;
  gap: 7px;
}

.canvas-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: stretch;
  padding: 7px 9px 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 7px 18px rgba(24, 66, 89, 0.08);
}

.canvas-card::before {
  display: none;
}

.canvas-topline {
  width: 100%;
  min-height: 27px;
  flex: 0 0 auto;
  padding: 0 3px 5px;
  font-size: 0.75rem;
}

.active-tool {
  padding: 4px 8px;
}

.canvas-viewport {
  display: grid;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  place-items: center;
  padding: 3px;
  overflow: hidden;
}

.canvas-frame {
  flex: 0 0 auto;
  margin: 0;
  background: #fff;
  border: 3px solid var(--navy);
  border-radius: 15px;
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.92),
    0 9px 20px rgba(24, 66, 89, 0.16);
}

.canvas-message {
  width: 100%;
  min-height: 25px;
  flex: 0 0 auto;
  padding: 4px 5px 0;
}

.canvas-message p {
  font-size: 0.74rem;
}

.message-icon {
  font-size: 1rem;
}

.bottom-toolbar {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 7px 18px rgba(24, 66, 89, 0.08);
}

.tool-strip {
  display: flex;
  min-width: 0;
  align-items: stretch;
  gap: 6px;
}

.bottom-toolbar .toolbar-group,
.history-actions {
  display: flex;
  min-width: 0;
  flex: 1 1 0;
  flex-direction: column;
  gap: 3px;
}

.bottom-toolbar .tools-horizontal,
.bottom-toolbar .history-actions {
  flex-grow: 1.08;
}

.bottom-toolbar .control-label {
  margin: 0 0 1px 2px;
  font-size: 0.62rem;
}

.button-grid,
.bottom-toolbar .size-options {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.bottom-toolbar .tool-button,
.bottom-toolbar .size-button,
.bottom-toolbar .icon-action {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  flex-direction: row;
  gap: 5px;
  padding: 5px 6px;
  border-radius: 10px;
}

.bottom-toolbar .tool-button .icon,
.bottom-toolbar .icon-action .icon {
  width: 20px;
  height: 20px;
}

.bottom-toolbar .tool-button span,
.bottom-toolbar .size-button span:last-child,
.bottom-toolbar .icon-action span {
  overflow: hidden;
  font-size: clamp(0.62rem, 0.62vw, 0.75rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-toolbar .size-button {
  flex-direction: column;
  gap: 2px;
}

.bottom-toolbar .small-dot {
  width: 6px;
  height: 6px;
}

.bottom-toolbar .medium-dot {
  width: 11px;
  height: 11px;
}

.bottom-toolbar .large-dot {
  width: 17px;
  height: 17px;
}

.bottom-toolbar .toolbar-divider {
  width: 0;
  height: auto;
  margin: 3px 0;
  border: 0;
  border-left: 2px dashed #ccdee3;
}

.bottom-toolbar .palette-save-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 145px;
  gap: 6px;
}

.bottom-toolbar .palette-section {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid #dce9ed;
  border-radius: 11px;
  box-shadow: none;
}

.bottom-toolbar .palette-section h2 {
  font-size: 0.83rem;
}

.bottom-toolbar .color-palette {
  flex-wrap: nowrap;
  gap: clamp(3px, 0.45vw, 7px);
  overflow: hidden;
}

.bottom-toolbar .color-button,
.bottom-toolbar .custom-color-label {
  width: clamp(29px, 2.25vw, 37px);
  height: clamp(29px, 2.25vw, 37px);
  flex-basis: clamp(29px, 2.25vw, 37px);
  border-radius: 10px;
}

.bottom-toolbar .save-button {
  min-height: 45px;
  padding: 5px 8px;
  border-radius: 11px;
  box-shadow: 0 3px 0 #0b4e40;
}

.bottom-toolbar .save-button .icon-large {
  width: 25px;
  height: 25px;
}

.bottom-toolbar .save-button strong {
  font-size: 0.78rem;
}

.bottom-toolbar .save-button small {
  margin-top: 2px;
  font-size: 0.6rem;
}

.ad-slot {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(101, 212, 187, 0.08), rgba(255, 213, 95, 0.12)),
    #f7fbfc;
  border: 2px dashed #adc9d3;
  border-radius: 16px;
}

.ad-slot-label {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 9px;
  padding: 4px 7px;
  color: #617987;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 7px;
  font-family: Arial, sans-serif;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ad-slot > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.ad-slot > img[hidden] {
  display: none;
}

.ad-slot .ad-placeholder {
  width: 100%;
  height: 100%;
  padding: 20px 10px;
}

.ad-slot .ad-placeholder strong {
  font-size: 0.86rem;
}

.ad-slot .ad-placeholder span {
  font-size: 0.68rem;
}

@media (min-width: 1101px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }
}

@media (max-width: 1280px) and (min-width: 1101px) {
  .workspace {
    grid-template-columns: 205px minmax(0, 1fr) 165px;
    gap: 8px;
  }

  .left-sidebar {
    padding: 8px;
  }

  .activity-button {
    min-height: 44px;
  }

  .bottom-toolbar .tool-button,
  .bottom-toolbar .size-button,
  .bottom-toolbar .icon-action {
    min-height: 45px;
  }

  .bottom-toolbar .tool-button,
  .bottom-toolbar .icon-action {
    flex-direction: column;
    gap: 1px;
  }

  .bottom-toolbar .palette-save-row {
    grid-template-columns: minmax(0, 1fr) 125px;
  }

  .bottom-toolbar .palette-section h2 {
    display: none;
  }
}

@media (max-width: 1100px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .topbar {
    height: 60px;
  }

  .workspace {
    height: auto;
    min-height: calc(100vh - 60px);
    grid-template-columns: 210px minmax(0, 1fr);
    padding: 10px 0.5cm;
    overflow: visible;
  }

  .left-sidebar,
  .studio {
    height: auto;
    overflow: visible;
  }

  .paint-layout {
    height: auto;
  }

  .canvas-card {
    min-height: 500px;
  }

  .canvas-viewport {
    min-height: 420px;
  }

  .ad-slot {
    grid-column: 1 / -1;
    min-height: 150px;
    max-height: 220px;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding-inline: 0.5cm;
  }

  .sound-toggle span {
    display: none;
  }

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

  .left-sidebar {
    display: flex;
  }

  .activity-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .activity-list-title {
    grid-column: 1 / -1;
  }

  .activity-button {
    min-height: 62px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
  }

  .activity-button > span {
    align-items: center;
    font-size: 0.78rem;
  }

  .chooser .drawing-gallery {
    max-height: 230px;
  }

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

  .bottom-toolbar .toolbar-divider {
    display: none;
  }

  .bottom-toolbar .palette-save-row {
    grid-template-columns: 1fr;
  }

  .bottom-toolbar .color-palette {
    flex-wrap: wrap;
    overflow: visible;
  }

  .ad-slot {
    grid-column: 1;
  }
}

/* V5: guardado en el encabezado, pizarra expandida y pantalla completa */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-save-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px;
  color: var(--navy-dark);
  background: var(--sun);
  border: 2px solid #e2b22e;
  border-radius: 13px;
  box-shadow: 0 3px 0 #b88819;
  cursor: pointer;
}

.header-save-button span {
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 900;
}

.header-save-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #b88819;
}

.canvas-card {
  padding: 5px 6px 3px;
}

.canvas-viewport {
  padding: 1px;
}

.canvas-frame {
  width: 100%;
  height: 100%;
  border-radius: 13px;
  box-shadow: 0 5px 14px rgba(24, 66, 89, 0.14);
}

.bottom-toolbar .palette-save-row {
  grid-template-columns: minmax(0, 1fr);
}

.bottom-toolbar .palette-section {
  padding-inline: 10px;
}

.bottom-toolbar .color-palette {
  justify-content: space-evenly;
}

.fullscreen-row {
  display: flex;
  min-height: 38px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

.fullscreen-button {
  display: inline-flex;
  min-width: 210px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 17px;
  color: var(--navy);
  background: #fff;
  border: 2px solid #a9c4ce;
  border-radius: 12px;
  box-shadow: 0 3px 0 rgba(35, 73, 106, 0.16);
  cursor: pointer;
}

.fullscreen-button span {
  font-family: Arial, sans-serif;
  font-size: 0.88rem;
  font-weight: 900;
}

.fullscreen-button[aria-pressed="true"] {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy-dark);
}

.save-dialog {
  width: min(520px, calc(100% - 30px));
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(10, 37, 55, 0.3);
}

.save-dialog::backdrop {
  background: rgba(13, 40, 58, 0.58);
  backdrop-filter: blur(3px);
}

.save-dialog form {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 25px;
  text-align: center;
}

.save-dialog-icon {
  color: #126b57;
  background: var(--mint-soft);
}

.save-dialog h2 {
  margin: 15px 0 6px;
  font-size: 1.42rem;
}

.save-dialog > form > p {
  margin: 0;
  color: var(--muted-ink);
  font-family: Arial, sans-serif;
  font-size: 1rem;
}

.save-format-options {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.save-format-button {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 12px;
  color: var(--navy-dark);
  background: #f3f9fb;
  border: 3px solid #b9d1d9;
  border-radius: 16px;
  cursor: pointer;
}

.save-format-button span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.save-format-button strong {
  font-size: 1.05rem;
}

.save-format-button small {
  margin-top: 4px;
  color: var(--muted-ink);
  font-family: Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
}

.save-format-button.image-format {
  background: var(--mint-soft);
  border-color: #72cbb7;
}

.save-format-button.pdf-format {
  background: #fff2ef;
  border-color: #efa59f;
}

.save-cancel {
  width: 100%;
  min-height: 46px;
  margin-top: 12px;
  border-radius: 13px;
  cursor: pointer;
}

.studio:fullscreen,
.studio:-webkit-full-screen,
.studio.is-fallback-fullscreen {
  width: 100vw;
  height: 100vh;
  padding: 0.25cm 0.5cm;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 3%, rgba(101, 212, 187, 0.18), transparent 24rem),
    radial-gradient(circle at 94% 12%, rgba(255, 213, 95, 0.18), transparent 22rem),
    var(--page);
}

.studio.is-fallback-fullscreen {
  position: fixed;
  z-index: 2000;
  inset: 0;
}

.fallback-fullscreen-open,
.fallback-fullscreen-open body {
  overflow: hidden !important;
}

@media (hover: hover) {
  .header-save-button:hover,
  .fullscreen-button:hover,
  .save-format-button:hover {
    filter: brightness(1.04);
  }
}

@media (max-width: 1280px) and (min-width: 1101px) {
  .bottom-toolbar .palette-save-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .fullscreen-row {
    min-height: 35px;
  }

  .fullscreen-button {
    min-height: 35px;
  }
}

@media (max-width: 760px) {
  .header-actions {
    gap: 5px;
  }

  .header-save-button {
    padding-inline: 10px;
  }

  .save-format-options {
    grid-template-columns: 1fr;
  }

  .fullscreen-button {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .header-save-button span {
    display: none;
  }

  .header-save-button {
    width: 42px;
    padding: 6px;
  }
}

/* V6: navegación superior y anuncio limitado a la altura de la pizarra */
body {
  background:
    radial-gradient(circle at 7% 4%, rgba(37, 137, 216, 0.08), transparent 23rem),
    radial-gradient(circle at 94% 8%, rgba(255, 209, 63, 0.12), transparent 24rem),
    #fffaf1;
}

.topbar {
  position: relative;
  height: 72px;
  min-height: 72px;
  padding: 7px 0.5cm 9px;
  color: var(--navy-dark);
  background: rgba(255, 255, 255, 0.96);
  border: 0;
  box-shadow: 0 2px 10px rgba(24, 66, 89, 0.06);
}

.topbar::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  content: "";
  background: linear-gradient(
    90deg,
    #1679e8 0 25%,
    #ff4b5c 25% 50%,
    #26ad70 50% 75%,
    #ffbd2d 75% 100%
  );
}

.brand-mark {
  width: 47px;
  height: 47px;
  color: #11518d;
  background: #fff;
  border: 3px solid #d8e9f7;
  border-radius: 15px;
  box-shadow: 0 3px 0 rgba(21, 83, 139, 0.17);
}

.brand-mark span {
  font-size: 1.7rem;
}

.brand-kicker {
  color: #164a7b;
  font-size: 0.72rem;
  letter-spacing: 0.09em;
}

.brand h1 {
  color: #133f70;
  font-size: 1.8rem;
}

.sound-toggle {
  min-height: 45px;
  color: #123f70;
  background: #fff;
  border: 2px solid #3974a8;
  border-radius: 13px;
}

.sound-toggle[aria-pressed="true"] {
  color: #123f70;
  background: #dff7ef;
  border-color: #24a978;
}

.header-save-button {
  min-height: 45px;
  padding-inline: 18px;
  color: #103f70;
  background: linear-gradient(180deg, #ffd563, #ffc43c);
  border-color: #eba91a;
  border-radius: 13px;
}

.workspace {
  display: grid;
  width: 100%;
  height: calc(100vh - 72px);
  grid-template: 62px 68px minmax(0, 1fr) 94px / minmax(0, 1fr);
  gap: 7px;
  align-items: stretch;
  padding: 8px 0.5cm 9px;
  overflow: hidden;
}

.main-tabs {
  display: grid;
  min-width: 0;
  height: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  background: #fff;
  border: 1px solid #d9e6eb;
  border-radius: 16px;
  box-shadow: 0 5px 15px rgba(24, 66, 89, 0.09);
}

.main-tab {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 8px 16px;
  color: #124577;
  background: #fff;
  border: 0;
  border-right: 1px solid #dce7eb;
  cursor: pointer;
}

.main-tab:last-child {
  border-right: 0;
}

.main-tab > span {
  overflow: hidden;
  font-size: clamp(1rem, 1.25vw, 1.3rem);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-tab .icon-large {
  width: 35px;
  height: 35px;
  stroke-width: 2.3;
}

.main-tab.coloring-tab .icon {
  color: #1679e8;
}

.main-tab.puzzle-tab .icon {
  color: #25ac6e;
}

.main-tab.matching-tab .icon {
  color: #ff4b5c;
}

.main-tab.is-active {
  background: linear-gradient(180deg, #eaf4ff, #f8fbff);
}

.main-tab.is-active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  content: "";
  background: #1679e8;
}

.main-tab:disabled {
  cursor: default;
  opacity: 1;
}

.category-bar {
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid #dce8ec;
  border-radius: 15px;
  box-shadow: 0 4px 13px rgba(24, 66, 89, 0.08);
}

.category-bar .compact-upload {
  width: auto;
  min-width: 150px;
  min-height: 48px;
  flex: 0 0 auto;
  gap: 8px;
  margin: 0;
  padding: 8px 13px;
  color: #9e6500;
  background: #fffdf8;
  border: 2px solid #f1aa19;
  border-radius: 12px;
  box-shadow: 0 2px 0 rgba(207, 137, 0, 0.25);
}

.category-bar .compact-upload strong {
  font-size: 0.88rem;
}

.category-rule {
  width: 0;
  height: 40px;
  flex: 0 0 auto;
  border-left: 2px solid #e1eaed;
}

.category-options {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 7px;
  overflow: hidden;
}

.category-label {
  flex: 0 0 auto;
  color: #315d82;
  font-family: Arial, sans-serif;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.category-button {
  display: inline-flex;
  min-width: 0;
  min-height: 42px;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  color: #164878;
  background: #f2f7fb;
  border: 2px solid transparent;
  border-radius: 11px;
  cursor: pointer;
}

.category-button .icon {
  width: 23px;
  height: 23px;
}

.category-button span {
  overflow: hidden;
  font-family: Arial, sans-serif;
  font-size: clamp(0.72rem, 0.72vw, 0.86rem);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-button.is-selected {
  color: #0b60bf;
  background: #e4f0ff;
  border-color: #c9def9;
}

.animals-category .icon { color: #1679e8; }
.nature-category .icon { color: #24aa6d; }
.vehicles-category .icon { color: #ec4453; }
.characters-category .icon { color: #f4ad17; }
.letters-category .icon { color: #23496a; }

.mold-actions {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.current-mold-chip {
  display: flex;
  min-width: 0;
  max-width: 155px;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  color: #184b7a;
  background: #f8fbfc;
  border: 1px solid #d8e6eb;
  border-radius: 10px;
}

.current-mold-chip span {
  overflow: hidden;
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.change-mold-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 11px;
  color: #075fc4;
  background: #fff;
  border: 2px solid #1680ee;
  border-radius: 11px;
  cursor: pointer;
}

.change-mold-button span {
  font-family: Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.canvas-ad-row {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
  grid-template-columns: minmax(0, 1fr) clamp(185px, 13vw, 225px);
  gap: 10px;
  overflow: hidden;
}

.studio {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.canvas-card {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  padding: 7px;
  overflow: hidden;
  background: #fff;
  border: 3px solid #174b79;
  border-radius: 15px;
  box-shadow: 0 4px 13px rgba(24, 66, 89, 0.08);
}

.canvas-topline {
  width: 100%;
  min-height: 31px;
  flex: 0 0 auto;
  padding: 0 4px 5px;
  color: #123f70;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 900;
}

.current-drawing {
  min-width: 0;
}

.current-drawing span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-tool {
  padding: 5px 11px;
  color: #0d477d;
  background: #e9f3fb;
  border-radius: 18px;
  font-size: 0.78rem;
}

.canvas-viewport {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  padding: 0;
  overflow: hidden;
}

.canvas-frame {
  width: 100%;
  height: 100%;
  margin: 0;
  background: #fff;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
}

.canvas-message {
  position: absolute;
  z-index: 4;
  right: 14px;
  bottom: 8px;
  left: 14px;
  width: auto;
  min-height: 0;
  justify-content: center;
  padding: 4px 10px;
  pointer-events: none;
}

.canvas-message p {
  padding: 4px 9px;
  color: #315d7c;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 10px;
  font-size: 0.74rem;
}

.ad-slot {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  place-items: center;
  background: rgba(255, 255, 255, 0.64);
  border: 2px dashed #a9cde3;
  border-radius: 15px;
  box-shadow: none;
}

.ad-slot-label {
  top: 10px;
  left: 11px;
  color: #295985;
  background: #fff;
  font-size: 0.68rem;
}

.bottom-toolbar {
  display: block;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 6px 9px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #dce8ec;
  border-radius: 15px;
  box-shadow: 0 4px 13px rgba(24, 66, 89, 0.08);
}

.bottom-toolbar .tool-strip {
  display: flex;
  min-width: 0;
  height: 100%;
  align-items: stretch;
  gap: 8px;
}

.bottom-toolbar .toolbar-group,
.bottom-toolbar .history-actions {
  display: flex;
  min-width: 0;
  flex: 1 1 0;
  flex-direction: column;
  gap: 4px;
}

.bottom-toolbar .tools-horizontal { flex-grow: 1.05; }
.bottom-toolbar .size-group { flex-grow: 0.62; }
.bottom-toolbar .palette-toolbar-group { flex-grow: 1.9; }
.bottom-toolbar .history-actions { flex-grow: 1.48; }

.bottom-toolbar .control-label {
  min-height: 13px;
  margin: 0 0 0 2px;
  color: #315c80;
  font-size: 0.67rem;
}

.bottom-toolbar .button-grid,
.bottom-toolbar .size-options {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.bottom-toolbar .action-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bottom-toolbar .tool-button,
.bottom-toolbar .size-button,
.bottom-toolbar .icon-action,
.bottom-toolbar .fullscreen-button {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 57px;
  flex-direction: column;
  gap: 3px;
  padding: 5px 4px;
  border-radius: 10px;
  box-shadow: none;
}

.bottom-toolbar .tool-button span,
.bottom-toolbar .size-button span:last-child,
.bottom-toolbar .icon-action span,
.bottom-toolbar .fullscreen-button span {
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(0.63rem, 0.62vw, 0.75rem);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-toolbar .tool-button .icon,
.bottom-toolbar .icon-action .icon,
.bottom-toolbar .fullscreen-button .icon {
  width: 22px;
  height: 22px;
}

.bottom-toolbar .size-button span:last-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.bottom-toolbar .size-button {
  position: relative;
  justify-content: center;
}

.bottom-toolbar .small-dot {
  width: 11px;
  height: 11px;
}

.bottom-toolbar .medium-dot {
  width: 19px;
  height: 19px;
}

.bottom-toolbar .large-dot {
  width: 28px;
  height: 28px;
}

.bottom-toolbar .toolbar-divider {
  width: 0;
  height: auto;
  margin: 2px 1px;
  border: 0;
  border-left: 2px dashed #c9dce4;
}

.palette-toolbar-group .color-palette {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-evenly;
  gap: clamp(3px, 0.4vw, 7px);
  overflow: hidden;
}

.palette-toolbar-group .color-button,
.palette-toolbar-group .custom-color-label {
  width: clamp(29px, 2.25vw, 39px);
  height: clamp(29px, 2.25vw, 39px);
  flex: 0 1 clamp(29px, 2.25vw, 39px);
  border-radius: 999px;
}

.bottom-toolbar .fullscreen-button {
  color: #144a7c;
  background: #fff;
  border: 2px solid #d6e4ea;
}

.bottom-toolbar .fullscreen-button[aria-pressed="true"] {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy-dark);
}

.mold-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: min(82vh, 760px);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(10, 37, 55, 0.3);
}

.mold-dialog::backdrop {
  background: rgba(13, 40, 58, 0.58);
  backdrop-filter: blur(3px);
}

.mold-dialog form {
  display: flex;
  max-height: min(82vh, 760px);
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
}

.mold-dialog-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-kicker {
  color: #1679e8;
  font-family: Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mold-dialog-heading h2 {
  margin: 2px 0 0;
  color: #123f70;
  font-size: 1.45rem;
}

.dialog-close-button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  color: #174b79;
  background: #f2f7f9;
  border: 2px solid #c4d8df;
  border-radius: 12px;
  cursor: pointer;
}

.mold-dialog .dialog-blank-button {
  width: 100%;
  min-height: 48px;
  flex: 0 0 auto;
  margin-top: 15px;
  border-radius: 12px;
}

.mold-dialog .gallery-title-row {
  flex: 0 0 auto;
  margin-top: 14px;
  padding-top: 12px;
}

.mold-dialog .gallery-title-row h3 {
  margin: 0;
}

.mold-dialog .drawing-gallery {
  display: grid;
  min-height: 160px;
  max-height: none;
  flex: 1 1 auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
  overflow: auto;
}

.mold-dialog .empty-gallery {
  min-height: 180px;
}

.mold-dialog .dialog-privacy-note {
  flex: 0 0 auto;
  margin: 12px 2px 0;
}

.app-shell:fullscreen,
.app-shell:-webkit-full-screen,
.app-shell.is-fallback-fullscreen {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #fffaf1;
}

.app-shell.is-fallback-fullscreen {
  position: fixed;
  z-index: 2000;
  inset: 0;
}

@media (hover: hover) {
  .main-tab:not(:disabled):hover,
  .category-button:hover,
  .change-mold-button:hover,
  .dialog-close-button:hover {
    filter: brightness(1.04);
  }
}

@media (max-width: 1350px) and (min-width: 1101px) {
  .category-bar .compact-upload {
    min-width: 132px;
    padding-inline: 9px;
  }

  .category-label {
    display: none;
  }

  .category-button {
    padding-inline: 7px;
  }

  .current-mold-chip {
    max-width: 105px;
  }

  .bottom-toolbar .tool-strip {
    gap: 5px;
  }
}

@media (max-width: 1100px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .topbar {
    height: 72px;
  }

  .workspace {
    height: auto;
    min-height: calc(100vh - 72px);
    grid-template: 62px auto minmax(500px, 64vh) auto / minmax(0, 1fr);
    overflow: visible;
  }

  .category-bar {
    min-height: 68px;
    flex-wrap: wrap;
    overflow: visible;
  }

  .category-options {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .category-button {
    flex: 0 0 auto;
  }

  .canvas-ad-row {
    grid-template-columns: minmax(0, 1fr) 165px;
  }

  .bottom-toolbar {
    min-height: 178px;
  }

  .bottom-toolbar .tool-strip {
    display: grid;
    grid-template-columns: 1fr 0.7fr 1.7fr 1.5fr;
  }
}

@media (max-width: 800px) {
  .topbar {
    padding-inline: 0.5cm;
  }

  .brand-kicker {
    display: none;
  }

  .main-tab {
    flex-direction: column;
    gap: 3px;
    padding-inline: 5px;
  }

  .main-tab .icon-large {
    width: 27px;
    height: 27px;
  }

  .main-tab > span {
    font-size: 0.75rem;
  }

  .canvas-ad-row {
    height: auto;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .studio {
    min-height: 500px;
  }

  .ad-slot {
    min-height: 150px;
    max-height: 190px;
  }

  .bottom-toolbar .tool-strip {
    grid-template-columns: 1fr 0.8fr;
  }

  .bottom-toolbar .palette-toolbar-group,
  .bottom-toolbar .history-actions {
    min-height: 78px;
  }

  .bottom-toolbar .toolbar-divider {
    display: none;
  }

  .mold-dialog .drawing-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .brand h1 {
    font-size: 1.35rem;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .category-bar .compact-upload,
  .change-mold-button {
    flex: 1 1 auto;
  }

  .category-rule,
  .current-mold-chip {
    display: none;
  }

  .mold-actions {
    flex: 1 1 auto;
  }

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

  .bottom-toolbar {
    min-height: 330px;
  }

  .palette-toolbar-group .color-palette {
    flex-wrap: wrap;
    overflow: visible;
  }
}

/* V7: actividades agrupadas y opciones que cambian según la pestaña */

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

body {
  background: #fffaf2;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: 100%;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  position: relative;
  width: 100%;
  height: 46px;
  min-height: 46px;
  padding: 5px 0.5cm;
  color: #123f70;
  background: #fff;
  border: 0;
}

.brand {
  gap: 8px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-width: 2px;
  border-radius: 10px;
  box-shadow: 0 2px 0 rgba(21, 83, 139, 0.14);
}

.brand-mark span {
  font-size: 1.22rem;
}

.brand h1 {
  margin: 0;
  color: #133f70;
  font-size: 1.42rem;
  line-height: 1;
}

.header-actions {
  gap: 8px;
}

.sound-toggle,
.header-save-button {
  min-height: 34px;
  padding: 5px 12px;
  border-radius: 10px;
  font-size: 0.83rem;
}

.sound-toggle .icon,
.header-save-button .icon {
  width: 19px;
  height: 19px;
}

.workspace {
  display: grid;
  width: 100%;
  height: calc(100vh - 46px);
  grid-template: 80px 42px minmax(0, 1fr) / minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
  padding: 6px 0.5cm 9px;
  overflow: hidden;
}

.activity-menu {
  display: grid;
  min-width: 0;
  height: 100%;
  grid-template-columns: repeat(4, minmax(175px, 1fr)) minmax(135px, 0.74fr);
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.activity-group {
  --group-color: #1679e8;
  display: grid;
  min-width: 0;
  height: 100%;
  grid-template-rows: 20px minmax(0, 1fr);
  overflow: visible;
  background: #fff;
  border: 1px solid #d9e6eb;
  border-radius: 11px;
  box-shadow: 0 3px 9px rgba(24, 66, 89, 0.08);
}

.play-group { --group-color: #27ae69; }
.learn-group { --group-color: #ffbd20; }
.practice-group { --group-color: #ff5964; }
.more-group { --group-color: #8b54df; }

.activity-group-title {
  display: grid;
  min-width: 0;
  place-items: center;
  color: #fff;
  background: var(--group-color);
  border-radius: 10px 10px 0 0;
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.activity-group-buttons {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.more-group .activity-group-buttons {
  grid-template-columns: minmax(0, 1fr);
}

.activity-tab {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 5px;
  color: #174b79;
  background: #fff;
  border: 0;
  border-right: 1px solid #dfe9ed;
  border-radius: 0 0 0 10px;
  cursor: pointer;
}

.activity-tab:last-child {
  border-right: 0;
  border-radius: 0 0 10px;
}

.more-group .activity-tab {
  border-radius: 0 0 10px 10px;
}

.activity-tab .icon {
  width: 23px;
  height: 23px;
  color: var(--group-color);
  stroke-width: 2.25;
}

.activity-tab > span {
  max-width: 100%;
  overflow: hidden;
  font-family: Arial, sans-serif;
  font-size: clamp(0.72rem, 0.72vw, 0.83rem);
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-tab.is-active {
  z-index: 1;
  color: #075bb8;
  background: linear-gradient(180deg, #eaf4ff, #f9fcff);
  box-shadow: inset 0 0 0 2px #1680ee;
}

.activity-tab.is-active::after {
  position: absolute;
  z-index: 3;
  bottom: -7px;
  left: 50%;
  width: 12px;
  height: 12px;
  content: "";
  background: #f9fcff;
  border-right: 2px solid #1680ee;
  border-bottom: 2px solid #1680ee;
  transform: translateX(-50%) rotate(45deg);
}

.activity-tab:focus-visible {
  z-index: 4;
}

.activity-options {
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.activity-options-panel {
  width: 100%;
  height: 100%;
}

.category-bar {
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #fff;
  border: 1px solid #cfe0e7;
  border-radius: 10px;
  box-shadow: 0 3px 9px rgba(24, 66, 89, 0.07);
  scrollbar-width: thin;
}

.options-title {
  min-width: max-content;
  flex: 0 0 auto;
  color: #174b79;
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.category-bar .compact-upload {
  width: auto;
  min-width: 118px;
  min-height: 33px;
  gap: 6px;
  margin: 0;
  padding: 5px 9px;
  border-width: 2px;
  border-radius: 9px;
  box-shadow: none;
}

.category-bar .compact-upload .icon {
  width: 20px;
  height: 20px;
}

.category-bar .compact-upload strong {
  font-size: 0.78rem;
}

.category-rule {
  height: 30px;
  border-left-width: 1px;
}

.category-options {
  min-width: max-content;
  flex: 1 0 auto;
  gap: 5px;
  overflow: visible;
}

.category-label {
  font-size: 0.68rem;
}

.category-button {
  min-height: 30px;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px 7px;
  border-width: 1px;
  border-radius: 8px;
}

.category-button .icon {
  width: 17px;
  height: 17px;
}

.category-button span {
  font-size: 0.7rem;
}

.mold-actions {
  min-width: max-content;
  flex: 0 0 auto;
  gap: 6px;
}

.current-mold-chip {
  min-width: 125px;
  max-width: 155px;
  min-height: 31px;
  padding: 4px 7px;
  border-radius: 8px;
}

.current-mold-chip .icon {
  width: 18px;
  height: 18px;
}

.current-mold-chip span,
.change-mold-button span {
  font-size: 0.72rem;
}

.change-mold-button {
  min-height: 33px;
  gap: 5px;
  padding: 5px 8px;
  border-width: 2px;
  border-radius: 9px;
}

.change-mold-button .icon {
  width: 19px;
  height: 19px;
}

.future-options {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 5px 14px;
  color: #174b79;
  background: #fff;
  border: 1px solid #cfe0e7;
  border-radius: 10px;
  box-shadow: 0 3px 9px rgba(24, 66, 89, 0.07);
}

.future-options strong {
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.future-options span {
  padding: 6px 11px;
  color: #5c7283;
  background: #f1f6f8;
  border-radius: 8px;
  font-size: 0.76rem;
}

.canvas-ad-row {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
  grid-template-columns: minmax(0, 1fr) clamp(160px, 13vw, 205px);
  gap: 8px;
  overflow: hidden;
}

.activity-work-area {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 7px;
  overflow: hidden;
}

.activity-work-area.is-future {
  grid-template-columns: minmax(0, 1fr);
}

.side-toolbar {
  display: block;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 6px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #cfe0e7;
  border-radius: 11px;
  box-shadow: 0 4px 12px rgba(24, 66, 89, 0.1);
}

.side-toolbar .tool-strip {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: 5px;
}

.side-toolbar .toolbar-group,
.side-toolbar .history-actions {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 4px;
}

.side-toolbar .palette-toolbar-group {
  min-height: 0;
  flex: 1 1 auto;
}

.side-toolbar .control-label {
  min-height: 0;
  margin: 0;
  color: #174b79;
  font-family: Arial, sans-serif;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.side-toolbar .button-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
}

.side-toolbar .tool-button,
.side-toolbar .icon-action {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 25px;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 7px;
  box-shadow: none;
}

.side-toolbar .tool-button .icon,
.side-toolbar .icon-action .icon {
  width: 16px;
  height: 16px;
}

.side-toolbar .tool-button span,
.side-toolbar .icon-action span {
  min-width: 0;
  overflow: hidden;
  font-size: 0.68rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-toolbar .tool-button.is-selected {
  color: #fff;
  background: #1267b8;
  border-color: #0b569e;
}

.side-toolbar .toolbar-divider {
  width: 100%;
  height: 0;
  margin: 0;
  border: 0;
  border-top: 1px solid #c8dce5;
}

.side-toolbar .size-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
}

.side-toolbar .size-button {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 2px;
  place-items: center;
  border-radius: 7px;
  box-shadow: none;
}

.side-toolbar .size-button span:last-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.side-toolbar .small-dot { width: 8px; height: 8px; }
.side-toolbar .medium-dot { width: 12px; height: 12px; }
.side-toolbar .large-dot { width: 17px; height: 17px; }

.side-toolbar .color-palette {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  gap: 4px;
  overflow: visible;
}

.side-toolbar .color-button,
.side-toolbar .custom-color-label {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  justify-self: center;
  border-radius: 999px;
}

.side-toolbar .color-button.is-selected {
  outline-width: 2px;
  outline-offset: 2px;
}

.side-toolbar .history-actions {
  margin-top: auto;
}

.side-toolbar .history-actions .icon-action {
  min-height: 21px;
  padding-block: 3px;
}

.side-toolbar .fullscreen-button {
  min-height: 27px;
  white-space: normal;
}

.side-toolbar .fullscreen-button span {
  white-space: normal;
}

.studio {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.canvas-card {
  height: 100%;
  padding: 5px;
  border: 2px solid #17578f;
  border-radius: 11px;
}

.canvas-topline {
  min-height: 28px;
  padding: 0 4px 3px;
  font-size: 0.78rem;
}

.active-tool {
  padding: 4px 9px;
  font-size: 0.7rem;
}

.canvas-message {
  bottom: 5px;
  padding: 2px 8px;
}

.canvas-message p {
  font-size: 0.68rem;
}

.future-activity-stage {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
  place-content: center;
  justify-items: center;
  padding: 24px;
  text-align: center;
  background: #fff;
  border: 2px solid #cfe0e7;
  border-radius: 12px;
}

.future-stage-icon {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  color: #1679e8;
  background: #eaf4ff;
  border-radius: 20px;
}

.future-stage-icon .icon {
  width: 38px;
  height: 38px;
}

.future-activity-stage h2 {
  margin: 14px 0 5px;
  color: #123f70;
  font-size: 1.45rem;
}

.future-activity-stage p {
  margin: 0;
  color: #5b7284;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
}

.ad-slot {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 11px;
}

.ad-slot-label {
  top: 7px;
  left: 8px;
}

@media (hover: hover) {
  .activity-tab:hover {
    background: #f2f8fc;
  }
}

@media (max-width: 1100px) and (min-width: 761px) {
  .workspace {
    grid-template-rows: 80px 42px minmax(0, 1fr);
  }

  .activity-menu {
    grid-template-columns: repeat(4, minmax(170px, 1fr)) minmax(135px, 0.75fr);
  }

  .category-label,
  .category-button .icon {
    display: none;
  }

  .category-button {
    padding-inline: 6px;
  }

  .activity-work-area {
    grid-template-columns: 94px minmax(0, 1fr);
  }

  .canvas-ad-row {
    grid-template-columns: minmax(0, 1fr) 150px;
  }
}

@media (max-width: 760px) {
  html,
  body,
  .app-shell {
    height: auto;
    overflow: auto;
  }

  .topbar {
    height: 46px;
  }

  .workspace {
    height: auto;
    min-height: calc(100vh - 46px);
    grid-template: 80px 42px auto / minmax(0, 1fr);
    overflow: visible;
  }

  .activity-menu {
    grid-template-columns: repeat(4, 190px) 145px;
  }

  .category-bar {
    overflow-x: auto;
  }

  .canvas-ad-row {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }

  .activity-work-area {
    min-height: 560px;
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .activity-work-area.is-future {
    min-height: 420px;
    grid-template-columns: minmax(0, 1fr);
  }

  .ad-slot {
    min-height: 150px;
    max-height: 180px;
  }
}

@media (max-width: 520px) {
  .sound-toggle span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .sound-toggle {
    width: 40px;
    padding-inline: 8px;
  }

  .activity-work-area {
    min-height: 720px;
    grid-template: auto minmax(480px, 1fr) / minmax(0, 1fr);
  }

  .side-toolbar {
    height: auto;
  }

  .side-toolbar .tool-strip {
    display: grid;
    grid-template-columns: 1fr 0.7fr 1.35fr 1.05fr;
    align-items: start;
  }

  .side-toolbar .toolbar-divider {
    display: none;
  }

  .side-toolbar .palette-toolbar-group {
    flex: initial;
  }

  .side-toolbar .history-actions {
    margin-top: 0;
  }
}

/* V8: secciones principales, actividades desplegadas y selector de puntero */

.activity-menu {
  display: grid;
  min-width: 0;
  height: 100%;
  grid-template: 23px minmax(0, 1fr) / minmax(0, 1fr);
  gap: 0;
  overflow: visible;
  background: transparent;
}

.section-tabs {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.section-tab {
  --section-color: #1679e8;
  position: relative;
  display: grid;
  min-width: 0;
  height: 23px;
  padding: 2px 8px;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background: var(--section-color);
  border: 0;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.play-section { --section-color: #27ae69; }
.learn-section { --section-color: #ffb916; }
.practice-section { --section-color: #ff5964; }
.more-section { --section-color: #8b54df; }

.section-tab::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 0;
  content: "";
  background: #fff;
  transition: height 140ms ease;
}

.section-tab.is-active {
  filter: saturate(1.08) brightness(0.98);
  box-shadow: inset 0 0 0 2px rgba(8, 49, 83, 0.2);
}

.section-tab.is-active::after {
  height: 3px;
}

.activity-sections {
  min-width: 0;
  min-height: 0;
  overflow: visible;
  background: #fff;
  border: 1px solid #d9e6eb;
  border-top: 0;
  border-radius: 0 0 11px 11px;
  box-shadow: 0 3px 9px rgba(24, 66, 89, 0.08);
}

.activity-section {
  --section-color: #1679e8;
  width: 100%;
  height: 100%;
}

.play-activities { --section-color: #27ae69; }
.learn-activities { --section-color: #ffb916; }
.practice-activities { --section-color: #ff5964; }
.more-activities { --section-color: #8b54df; }

.activity-section .activity-group-buttons {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.activity-section .two-activities {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.activity-section .one-activity {
  grid-template-columns: minmax(0, 1fr);
}

.activity-section .activity-tab {
  border: 0;
  border-right: 1px solid #dfe9ed;
  border-radius: 0;
}

.activity-section .activity-tab:last-child {
  border-right: 0;
  border-radius: 0 0 10px;
}

.activity-section .activity-tab:first-child {
  border-radius: 0 0 0 10px;
}

.activity-section .one-activity .activity-tab {
  border-radius: 0 0 10px 10px;
}

.activity-section .activity-tab .icon {
  color: var(--section-color);
}

.activity-section .activity-tab.is-active {
  color: #0d477d;
  background: color-mix(in srgb, var(--section-color) 10%, white);
  box-shadow: inset 0 0 0 2px var(--section-color);
}

.activity-section .activity-tab.is-active::after {
  border-color: var(--section-color);
}

.pointer-picker-button {
  display: grid;
  min-width: 132px;
  min-height: 33px;
  flex: 0 0 auto;
  grid-template: auto auto / 22px minmax(0, 1fr);
  column-gap: 6px;
  align-items: center;
  padding: 3px 9px;
  color: #075fc4;
  background: #eef6ff;
  border: 2px solid #1680ee;
  border-radius: 9px;
  cursor: pointer;
}

.pointer-picker-button .icon {
  width: 20px;
  height: 20px;
  grid-row: 1 / 3;
}

.pointer-picker-button > span,
.pointer-picker-button > small {
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pointer-picker-button > span {
  align-self: end;
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
}

.pointer-picker-button > small {
  align-self: start;
  color: #486a87;
  font-family: Arial, sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
}

.activity-work-area {
  grid-template-columns: 128px minmax(0, 1fr);
}

.side-toolbar {
  padding: 7px;
}

.side-toolbar .control-label {
  font-size: 0.7rem;
}

.side-toolbar .tool-button,
.side-toolbar .icon-action {
  min-height: 26px;
  gap: 7px;
  padding-inline: 7px;
}

.side-toolbar .tool-button .icon,
.side-toolbar .icon-action .icon {
  width: 18px;
  height: 18px;
}

.side-toolbar .tool-button span,
.side-toolbar .icon-action span {
  font-size: 0.72rem;
}

.side-toolbar .size-button {
  min-height: 27px;
}

.side-toolbar .small-dot { width: 9px; height: 9px; }
.side-toolbar .medium-dot { width: 14px; height: 14px; }
.side-toolbar .large-dot { width: 19px; height: 19px; }

.side-toolbar .color-button,
.side-toolbar .custom-color-label {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
}

.side-toolbar .history-actions .icon-action {
  min-height: 22px;
}

.side-toolbar .fullscreen-button {
  min-height: 28px;
}

.pointer-dialog {
  width: min(980px, calc(100% - 28px));
  max-height: min(90vh, 720px);
  padding: 0;
  overflow: hidden;
  color: #16324a;
  background: #fff;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(10, 37, 55, 0.3);
}

.pointer-dialog::backdrop {
  background: rgba(13, 40, 58, 0.58);
  backdrop-filter: blur(3px);
}

.pointer-dialog form {
  display: flex;
  max-height: min(90vh, 720px);
  flex-direction: column;
  padding: 18px;
  overflow: hidden;
}

.pointer-dialog-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.pointer-dialog-heading h2 {
  margin: 2px 0 0;
  color: #123f70;
  font-size: 1.45rem;
}

.pointer-dialog-heading p {
  margin: 3px 0 0;
  color: #5c7283;
  font-family: Arial, sans-serif;
  font-size: 0.88rem;
}

.pointer-options-grid {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
  margin-top: 15px;
  padding: 3px;
  overflow-y: auto;
}

.pointer-option {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 160px;
  grid-template-rows: minmax(76px, 1fr) auto auto;
  justify-items: center;
  gap: 3px;
  padding: 15px 9px 10px;
  color: #123f70;
  background: #edf6ff;
  border: 2px solid #cde3f5;
  border-radius: 16px;
  cursor: pointer;
}

.pointer-option:nth-child(2),
.pointer-option:nth-child(7) {
  background: #ecfbf4;
  border-color: #bfead5;
}

.pointer-option:nth-child(3) {
  background: #fff8dc;
  border-color: #f5dc83;
}

.pointer-option:nth-child(4),
.pointer-option:nth-child(6) {
  background: #fff0f1;
  border-color: #f5cdd1;
}

.pointer-option:nth-child(8) {
  background: #f5efff;
  border-color: #ded0f5;
}

.pointer-option.is-selected {
  border-color: #1680ee;
  box-shadow: 0 0 0 3px rgba(22, 128, 238, 0.2);
}

.pointer-number {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  background: #1680ee;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
}

.recommended-label {
  position: absolute;
  z-index: 2;
  top: 9px;
  right: 8px;
  padding: 4px 7px;
  color: #fff;
  background: #19a86b;
  border-radius: 999px;
  font-family: Arial, sans-serif;
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pointer-preview {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 76px;
  place-items: center;
  color: #1680ee;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 11px;
}

.pointer-preview::after {
  position: absolute;
  right: 18%;
  bottom: 20px;
  width: 42%;
  height: 8px;
  content: "";
  background: #2589d8;
  border-radius: 999px;
  transform: rotate(-5deg);
  opacity: 0.85;
}

.pointer-preview .icon {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  transform: translate(10px, -3px) rotate(-12deg);
}

.pointer-preview i {
  position: absolute;
  z-index: 2;
  right: 30%;
  bottom: 17px;
  width: 25px;
  height: 25px;
  background: rgba(37, 137, 216, 0.13);
  border: 2px solid #51a8ef;
  border-radius: 999px;
}

.cross-preview .icon {
  transform: none;
}

.crayon-preview .icon { color: #ef4d59; }
.brush-preview .icon { color: #b06a31; }
.finger-preview .icon { color: #ef8f63; transform: rotate(-18deg); }
.bucket-preview .icon { color: #2589d8; transform: rotate(-12deg); }
.eraser-preview .icon { color: #f06c80; }

.pointer-option > strong {
  max-width: 100%;
  font-size: 0.92rem;
  line-height: 1.05;
  text-align: center;
}

.pointer-option > small {
  max-width: 100%;
  color: #58728a;
  font-family: Arial, sans-serif;
  font-size: 0.74rem;
  line-height: 1.1;
  text-align: center;
}

@media (hover: hover) {
  .section-tab:hover {
    filter: brightness(1.06);
  }

  .pointer-picker-button:hover,
  .pointer-option:hover {
    filter: brightness(1.025);
  }
}

@media (max-width: 1180px) and (min-width: 761px) {
  .pointer-picker-button {
    min-width: 105px;
  }

  .pointer-picker-button > small {
    display: none;
  }

  .pointer-picker-button .icon {
    grid-row: 1;
  }

  .activity-work-area {
    grid-template-columns: 116px minmax(0, 1fr);
  }
}

@media (max-width: 800px) {
  .pointer-options-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .section-tabs {
    min-width: 560px;
  }

  .activity-menu {
    overflow-x: auto;
    overflow-y: visible;
  }

  .activity-sections {
    min-width: 560px;
  }

  .pointer-options-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .pointer-dialog form {
    padding: 14px;
  }
}

/* V9: encabezado más alto y opciones de Colorear por bloques */

:root {
  --v9-header-height: calc(46px + 0.5cm);
}

.topbar {
  height: var(--v9-header-height);
  min-height: var(--v9-header-height);
  padding-block: 8px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.brand-mark span {
  font-size: 1.5rem;
}

.brand h1 {
  font-size: 1.7rem;
}

.sound-toggle,
.header-save-button {
  min-height: 42px;
  padding-inline: 15px;
  font-size: 0.9rem;
}

.workspace {
  height: calc(100vh - var(--v9-header-height));
  grid-template-rows: 80px 112px minmax(0, 1fr);
}

.colorful-options-bar {
  display: grid;
  grid-template-columns: 128px 196px 192px minmax(218px, 0.9fr) minmax(410px, 1.8fr);
  gap: 7px;
  padding: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #fff;
  border-color: #d8e5ea;
  border-radius: 15px;
  scrollbar-width: none;
}

.colorful-options-bar::-webkit-scrollbar {
  display: none;
}

.option-cluster {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 18px minmax(0, 1fr);
  gap: 4px;
  padding: 6px 7px 7px;
  border: 1px solid transparent;
  border-radius: 13px;
}

.image-cluster {
  background: linear-gradient(180deg, #fffaf0, #fff5dc);
  border-color: #f6e6bd;
}

.tools-cluster {
  background: linear-gradient(180deg, #f2f8ff, #e8f3ff);
  border-color: #d5e7fb;
}

.strokes-cluster {
  background: linear-gradient(180deg, #fbf7ff, #f2eaff);
  border-color: #e8dcfa;
}

.molds-cluster {
  background: linear-gradient(180deg, #fff6f6, #ffeded);
  border-color: #f7dada;
}

.categories-cluster {
  background: linear-gradient(180deg, #f3f9ff, #e9f4ff);
  border-color: #d7e7f7;
}

.option-cluster-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #174b79;
  font-family: Arial, sans-serif;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-cluster .option-cluster-title { color: #a86a00; }
.tools-cluster .option-cluster-title { color: #0966bf; }
.strokes-cluster .option-cluster-title { color: #7950c4; }
.molds-cluster .option-cluster-title { color: #d94253; }
.categories-cluster .option-cluster-title { text-align: left; }

.option-button-row,
.top-size-options {
  display: grid;
  min-width: 0;
  min-height: 0;
  gap: 6px;
}

.two-option-buttons,
.mold-option-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.option-tile,
.top-size-button,
.colorful-options-bar .category-button {
  min-width: 0;
  min-height: 0;
  background: #fff;
  border: 1px solid rgba(32, 86, 126, 0.12);
  border-radius: 10px;
  box-shadow: 0 3px 7px rgba(35, 73, 101, 0.12);
}

.colorful-options-bar .compact-upload {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
  margin: 0;
  padding: 4px 5px;
  color: #9a6100;
  background: linear-gradient(180deg, #ffc52c, #ffb70d);
  border: 2px solid #fff;
  box-shadow: 0 3px 7px rgba(179, 111, 0, 0.2);
}

.colorful-options-bar .compact-upload .icon {
  width: 28px;
  height: 28px;
}

.colorful-options-bar .compact-upload strong {
  color: #784900;
  font-size: 0.72rem;
  line-height: 1;
}

.colorful-options-bar .pointer-picker-button {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  grid-template: none;
  gap: 2px;
  justify-content: center;
  padding: 4px;
  color: #096bd0;
  background: #fff;
  border: 2px solid #1680ee;
}

.colorful-options-bar .pointer-picker-button .icon {
  width: 29px;
  height: 29px;
  grid-row: auto;
}

.colorful-options-bar .pointer-picker-button > span,
.colorful-options-bar .pointer-picker-button > small {
  align-self: auto;
  text-align: center;
}

.colorful-options-bar .pointer-picker-button > span {
  font-size: 0.68rem;
}

.colorful-options-bar .pointer-picker-button > small {
  width: 100%;
  color: #4d6c88;
  font-size: 0.52rem;
}

.colorful-options-bar .top-tool-button {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  color: #174b79;
}

.colorful-options-bar .top-tool-button .icon {
  width: 29px;
  height: 29px;
  color: #ef5263;
}

.colorful-options-bar .top-tool-button span {
  font-size: 0.68rem;
  font-weight: 900;
}

.colorful-options-bar .top-tool-button.is-selected {
  color: #fff;
  background: #ef5263;
  border-color: #d83d4e;
}

.colorful-options-bar .top-tool-button.is-selected .icon {
  color: #fff;
}

.top-size-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.colorful-options-bar .top-size-button {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 2px;
  color: #5b438a;
  box-shadow: 0 3px 7px rgba(35, 73, 101, 0.1);
}

.stroke-preview {
  width: 39px;
  height: 20px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-size-button[data-size="small"] .stroke-preview { stroke-width: 2.5; }
.top-size-button[data-size="medium"] .stroke-preview { stroke-width: 5; }
.top-size-button[data-size="large"] .stroke-preview { stroke-width: 8; }

.colorful-options-bar .top-size-button > span {
  font-family: Arial, sans-serif;
  font-size: 0.59rem;
  font-weight: 800;
  line-height: 1;
}

.colorful-options-bar .top-size-button.is-selected {
  color: #5d2aa8;
  background: #f4edff;
  border: 2px solid #8753dc;
}

.colorful-options-bar .current-mold-chip,
.colorful-options-bar .change-mold-button {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  max-width: none;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
}

.colorful-options-bar .current-mold-chip .icon,
.colorful-options-bar .change-mold-button .icon {
  width: 28px;
  height: 28px;
}

.colorful-options-bar .current-mold-chip .icon { color: #4b6172; }
.colorful-options-bar .change-mold-button .icon { color: #e94657; }

.colorful-options-bar .current-mold-chip span,
.colorful-options-bar .change-mold-button span {
  display: block;
  width: 100%;
  overflow: hidden;
  font-size: 0.6rem;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.colorful-options-bar .category-options {
  display: grid;
  width: 100%;
  min-width: 0;
  height: 100%;
  grid-template-columns: repeat(6, minmax(58px, 1fr));
  gap: 5px;
}

.colorful-options-bar .category-button {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 3px;
  color: #174b79;
}

.colorful-options-bar .category-button .icon {
  display: block;
  width: 27px;
  height: 27px;
}

.colorful-options-bar .category-button span {
  display: -webkit-box;
  width: 100%;
  overflow: hidden;
  font-size: 0.56rem;
  line-height: 1.05;
  text-align: center;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.colorful-options-bar .category-button.is-selected {
  background: #fff;
  border: 2px solid #1680ee;
  box-shadow: 0 0 0 2px rgba(22, 128, 238, 0.12);
}

.activity-work-area {
  grid-template-columns: 150px minmax(0, 1fr);
}

.side-toolbar {
  padding: 8px;
}

.side-toolbar .color-palette {
  gap: 5px;
}

.side-toolbar .color-button,
.side-toolbar .custom-color-label {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
}

@media (max-width: 1220px) and (min-width: 761px) {
  .colorful-options-bar {
    grid-template-columns: 116px 178px 175px 204px minmax(390px, 1fr);
  }

  .activity-work-area {
    grid-template-columns: 138px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .topbar {
    height: var(--v9-header-height);
    min-height: var(--v9-header-height);
  }

  .workspace {
    height: auto;
    min-height: calc(100vh - var(--v9-header-height));
    grid-template-rows: 80px 104px auto;
  }

  .colorful-options-bar {
    grid-template-columns: 116px 178px 175px 204px 410px;
  }

  .activity-work-area {
    grid-template-columns: 132px minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand h1 {
    font-size: 1.48rem;
  }

  .activity-work-area {
    grid-template: auto minmax(480px, 1fr) / minmax(0, 1fr);
  }
}

/* V10: Crear directo, herramientas ampliadas y punteros sin duplicados */

body[data-active-section="crear"] .workspace {
  grid-template-rows: 23px 112px minmax(0, 1fr);
}

body[data-active-section="crear"] .activity-menu {
  grid-template-rows: 23px 0;
}

body[data-active-section="crear"] .activity-sections {
  display: none;
}

.colorful-options-bar {
  grid-template-columns: 128px 276px 192px minmax(218px, 0.9fr) minmax(410px, 1.8fr);
}

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

.colorful-options-bar .top-tool-button span {
  max-width: 100%;
  line-height: 1.05;
  text-align: center;
  white-space: normal;
}

.colorful-options-bar .eraser-top-tool .icon {
  color: #ef5263;
}

.colorful-options-bar .fill-top-tool .icon {
  color: #2589d8;
}

.colorful-options-bar .eraser-top-tool.is-selected {
  color: #fff;
  background: #ef5263;
  border-color: #d83d4e;
}

.colorful-options-bar .fill-top-tool.is-selected {
  color: #fff;
  background: #2589d8;
  border-color: #116eb5;
}

.colorful-options-bar .eraser-top-tool.is-selected .icon,
.colorful-options-bar .fill-top-tool.is-selected .icon {
  color: #fff;
}

.activity-work-area {
  grid-template-columns: 172px minmax(0, 1fr);
}

.side-toolbar .tool-button,
.side-toolbar .icon-action {
  padding-inline: 9px;
}

.side-toolbar .tool-button span,
.side-toolbar .icon-action span {
  font-size: 0.76rem;
}

.side-toolbar .color-button,
.side-toolbar .custom-color-label {
  width: 25px;
  height: 25px;
  min-width: 25px;
  min-height: 25px;
}

.pointer-dialog {
  width: min(790px, calc(100% - 28px));
}

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

@media (max-width: 1220px) and (min-width: 761px) {
  .colorful-options-bar {
    grid-template-columns: 116px 248px 175px 204px minmax(390px, 1fr);
  }

  .activity-work-area {
    grid-template-columns: 156px minmax(0, 1fr);
  }
}

@media (max-width: 800px) {
  .pointer-options-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body[data-active-section="crear"] .workspace {
    grid-template-rows: 23px 104px auto;
  }

  .colorful-options-bar {
    grid-template-columns: 116px 248px 175px 204px 410px;
  }

  .activity-work-area {
    grid-template-columns: 146px minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .activity-work-area {
    grid-template: auto minmax(480px, 1fr) / minmax(0, 1fr);
  }

  .pointer-options-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* V11: controles sin duplicados, más colores y texto sobre la pizarra */

.colorful-options-bar {
  grid-template-columns: 128px minmax(410px, 1.05fr) 192px minmax(470px, 1.55fr);
}

.five-option-buttons {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.colorful-options-bar .text-top-tool .icon {
  color: #26a76f;
}

.colorful-options-bar .clear-top-tool {
  color: #c83b47;
  background: #fff8f8;
  border-color: #f3b9bf;
}

.colorful-options-bar .clear-top-tool .icon {
  color: #e44150;
}

.colorful-options-bar .clear-top-tool:hover:not(:disabled) {
  color: #fff;
  background: #e94b58;
  border-color: #cf3341;
}

.colorful-options-bar .clear-top-tool:hover:not(:disabled) .icon {
  color: #fff;
}

.side-toolbar .color-palette {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px 4px;
}

.side-toolbar .color-button,
.side-toolbar .custom-color-label {
  width: 25px;
  height: 25px;
  min-width: 25px;
  min-height: 25px;
}

.side-toolbar .palette-toolbar-group {
  flex: 1 1 auto;
}

.side-toolbar .history-actions .action-grid {
  gap: 5px;
}

.text-dialog {
  width: min(540px, calc(100% - 30px));
}

.text-dialog form {
  align-items: stretch;
  text-align: left;
}

.text-dialog-icon {
  align-self: center;
  color: #147a54;
  background: #e5f8f0;
}

.text-dialog h2,
.text-dialog > form > p {
  text-align: center;
}

.text-input-label,
.text-size-fieldset legend {
  margin-top: 18px;
  color: #174b79;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 900;
}

.text-dialog textarea {
  width: 100%;
  min-height: 82px;
  margin-top: 7px;
  padding: 12px 14px;
  resize: vertical;
  color: #173852;
  background: #f8fbfc;
  border: 3px solid #b8d5e3;
  border-radius: 14px;
  font: 800 1.1rem/1.35 Arial, sans-serif;
}

.text-dialog textarea:focus {
  border-color: #2589d8;
  outline: 4px solid rgba(37, 137, 216, 0.16);
}

.text-size-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.text-size-fieldset legend {
  padding: 0;
}

.text-size-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 7px;
}

.text-size-button {
  min-height: 48px;
  padding: 8px;
  color: #174b79;
  background: #f3f8fb;
  border: 2px solid #c6dce5;
  border-radius: 12px;
  cursor: pointer;
  font: 900 0.9rem/1 Arial, sans-serif;
}

.text-size-button.is-selected {
  color: #fff;
  background: #2589d8;
  border-color: #1267b8;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.13);
}

.text-color-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 14px;
  color: #4d6c80;
  font: 800 0.86rem/1.2 Arial, sans-serif;
}

#textColorPreview {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  background: #2589d8;
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 2px #9db9c5;
}

.insert-text-button {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 15px;
  padding: 10px 16px;
  color: #fff;
  background: #16815a;
  border: 2px solid #0f6747;
  border-radius: 14px;
  cursor: pointer;
  font: 900 1rem/1 Arial, sans-serif;
}

.insert-text-button .icon {
  width: 23px;
  height: 23px;
}

.dialog-save-first {
  color: #fff;
  background: #147a54;
  border: 2px solid #0c5d3e;
}

.confirm-dialog.has-save-option {
  width: min(650px, calc(100% - 30px));
}

.confirm-dialog.has-save-option .dialog-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1220px) and (min-width: 761px) {
  .colorful-options-bar {
    grid-template-columns: 116px 370px 175px minmax(420px, 1fr);
  }
}

@media (max-width: 760px) {
  .colorful-options-bar {
    grid-template-columns: 116px 370px 175px 420px;
  }

  .confirm-dialog.has-save-option .dialog-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .side-toolbar .tool-strip {
    grid-template-columns: 0.72fr 1.8fr 1.1fr;
  }

  .side-toolbar .color-button,
  .side-toolbar .custom-color-label {
    width: 23px;
    height: 23px;
    min-width: 23px;
    min-height: 23px;
  }

  .text-size-options {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* V12: texto directo sobre la pizarra y lienzo totalmente aprovechado */

.side-toolbar .color-palette {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px 6px;
}

.side-toolbar .color-button,
.side-toolbar .custom-color-label {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
}

.colorful-options-bar .text-top-tool.is-selected {
  color: #fff;
  background: #26a76f;
  border-color: #147a54;
}

.colorful-options-bar .text-top-tool.is-selected .icon {
  color: #fff;
}

.canvas-card {
  padding: 5px;
}

.canvas-viewport {
  width: 100%;
  height: 100%;
  flex: 1 1 100%;
}

.canvas-frame[data-tool="text"] #paintCanvas {
  cursor: text;
}

.canvas-text-editor {
  position: absolute;
  z-index: 4;
  min-width: 110px;
  max-width: calc(100% - 12px);
  height: auto;
  min-height: 1.55em;
  padding: 0.08em 0.25em 0.13em;
  transform: var(--text-editor-transform, none);
  transform-origin: left top;
  overflow: hidden;
  color: var(--active-color);
  background: rgba(255, 255, 255, 0.94);
  border: 3px dashed currentColor;
  border-radius: 8px;
  outline: 4px solid rgba(37, 137, 216, 0.16);
  box-shadow: 0 4px 12px rgba(23, 56, 82, 0.16);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
  line-height: 1.15;
}

.canvas-text-editor::placeholder {
  color: #6c8090;
  opacity: 0.86;
}

@media (max-width: 520px) {
  .side-toolbar .color-palette {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px 4px;
  }

  .side-toolbar .color-button,
  .side-toolbar .custom-color-label {
    width: 29px;
    height: 29px;
    min-width: 29px;
    min-height: 29px;
  }
}

/* V13: puntero dividido, texto puntual y grupos superiores uniformes */

.colorful-options-bar {
  align-items: stretch;
}

.colorful-options-bar .option-cluster {
  height: 100%;
  align-self: stretch;
  box-sizing: border-box;
  margin: 0;
}

.pointer-split-control {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
  grid-template-columns: minmax(0, 1fr) 27px;
}

.colorful-options-bar .pointer-split-control .pointer-picker-button {
  border-radius: 10px 0 0 10px;
}

.colorful-options-bar .pointer-picker-button.is-selected {
  color: #fff;
  background: #1680ee;
  border-color: #0b66bc;
}

.colorful-options-bar .pointer-picker-button.is-selected > small,
.colorful-options-bar .pointer-picker-button.is-selected .icon {
  color: #fff;
}

.pointer-options-button {
  display: grid;
  width: 27px;
  min-width: 27px;
  min-height: 0;
  place-items: center;
  padding: 0;
  color: #096bd0;
  background: #edf6ff;
  border: 2px solid #1680ee;
  border-left: 0;
  border-radius: 0 10px 10px 0;
  cursor: pointer;
}

.pointer-options-button .icon {
  width: 17px;
  height: 17px;
  transform: rotate(90deg);
}

.pointer-options-button:hover:not(:disabled),
.pointer-options-button:focus-visible {
  color: #fff;
  background: #096bd0;
}

.pointer-options-button:focus-visible {
  position: relative;
  z-index: 2;
  outline: 3px solid rgba(255, 194, 24, 0.65);
  outline-offset: 1px;
}

.pointer-options-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.canvas-text-editor {
  width: 124px;
  min-width: 0;
  max-width: none;
  min-height: 1.34em;
  box-sizing: content-box;
  padding: 0 4px 0 2px;
  transform: none;
  color: var(--active-color);
  background: rgba(255, 255, 255, 0.86);
  border: 2px dashed currentColor;
  border-radius: 5px;
  outline: 3px solid rgba(255, 194, 24, 0.38);
  box-shadow: none;
  line-height: 1.05;
}

/* V14: documentos paginados y acceso permanente a plantillas. */
.options-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 18vw, 300px);
  gap: 8px;
  min-width: 0;
  min-height: 0;
}
.options-layout .activity-options { min-width: 0; min-height: 0; height: 100%; }
.options-layout .colorful-options-bar {
  height: 100%;
  grid-template-columns: 138px minmax(360px, 1.1fr) 172px minmax(450px, 1.5fr);
  scrollbar-width: thin;
  overflow-x: auto;
}
.upload-option-tile strong { white-space: normal; line-height: 1.1; }
.templates-panel {
  min-width: 0;
  height: 100%;
  padding: 7px;
  border: 1px solid #ded3f4;
  border-radius: 15px;
  background: #faf7ff;
}
.templates-button {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 12px; color: #67429f; background: #fff;
  border: 1px solid #d7c3f5; border-radius: 11px; cursor: pointer; text-align: left;
  box-shadow: 0 3px 0 #e9dff7;
}
.templates-button > .icon { width: 31px; height: 31px; flex-shrink: 0; }
.templates-button .templates-chevron { width: 18px; height: 18px; }
.templates-button strong { display: block; font-size: 15px; line-height: 1.24; }
.templates-button small { display: block; margin-top: 5px; font-size: 13px; color: #72538e; }
.templates-button:hover { background: #f2eaff; border-color: #9264d0; }
.templates-button:focus-visible, .page-controls button:focus-visible, .template-download:focus-visible {
  outline: 3px solid #1680ee; outline-offset: 2px;
}
.canvas-viewport { display: flex; align-items: center; justify-content: center; flex: 1 1 0; }
.canvas-frame { flex: 0 0 auto; }
.page-navigation {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex: 0 0 auto; min-height: 45px; padding: 3px 7px 7px;
  border-bottom: 1px solid #e3edf5; color: #23496a;
}
.page-navigation[hidden], .file-notice[hidden] { display: none; }
.document-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.page-controls { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.page-controls button {
  display: grid; place-items: center; width: 38px; height: 36px;
  background: #edf5ff; color: #0966bf; border: 1px solid #a7cdf3; border-radius: 9px; cursor: pointer;
}
.page-controls button:disabled { opacity: .38; cursor: default; }
.page-controls button:hover:not(:disabled) { background: #dcecff; }
.page-controls .icon { width: 20px; height: 20px; }
.previous-chevron { transform: rotate(180deg); }
#pageCounter { font-size: 13px; font-weight: 700; min-width: 100px; text-align: center; }
.file-notice { flex: 0 0 auto; margin: 3px 4px 6px; padding: 9px 12px; font-size: 13px; color: #854312; background: #fff5e4; border: 1px solid #f2c98e; border-radius: 7px; }
.templates-dialog {
  width: min(960px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 26px;
  color: #23496a; border: 1px solid #d8e5ed; border-radius: 20px; background: #fff;
  box-shadow: 0 25px 80px #15365340;
}
.templates-dialog::backdrop, .password-dialog::backdrop { background: #12293c88; }
.templates-heading { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.templates-heading h2 { margin: 6px 0 8px; font-size: 25px; color: #3c2a63; }
.templates-heading p { margin: 0; font-size: 14px; color: #617386; }
.templates-filters { display: grid; grid-template-columns: 1.5fr 1fr; gap: 15px; margin-top: 23px; }
.templates-filters label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 700; }
.templates-filters input, .templates-filters select { width: 100%; min-width: 0; height: 42px; padding: 8px 12px; border: 1px solid #c5d5e0; border-radius: 9px; color: #23496a; background: #fff; font: inherit; font-weight: 400; }
.templates-count { margin: 16px 0; font-size: 13px; color: #65758a; }
.templates-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.template-card { min-width: 0; display: flex; flex-direction: column; border: 1px solid #dce5ed; border-radius: 13px; padding: 12px; }
.template-preview { position: relative; display: grid; place-items: center; height: 148px; overflow: hidden; background: #f4f7fb; border-radius: 8px; }
.template-preview img { width: 100%; height: 100%; object-fit: contain; }
.template-format { padding: 5px 8px; position: absolute; top: 8px; left: 8px; z-index: 1; border-radius: 5px; font-size: 11px; font-weight: 800; color: #725097; background: #fff; }
.template-card h3 { font-size: 16px; margin: 13px 0 6px; overflow-wrap: anywhere; }
.template-card p { margin: 0 0 13px; color: #63758a; font-size: 13px; }
.template-download { display: block; margin-top: auto; padding: 10px; border-radius: 8px; color: #fff; background: #7550b2; font-size: 13px; font-weight: 700; text-decoration: none; text-align: center; }
.template-download:hover { background: #59338f; }
.templates-empty { grid-column: 1 / -1; padding: 55px 20px; text-align: center; background: #faf9fc; border: 1px dashed #cec0e3; border-radius: 12px; }
.templates-empty strong { font-size: 18px; color: #705290; }
.templates-empty p { font-size: 14px; color: #667586; }
.password-dialog { max-width: min(420px, calc(100vw - 28px)); padding: 26px; border: 1px solid #c5d5e0; border-radius: 18px; color: #23496a; }
.password-dialog h2 { margin: 0 0 10px; }
.password-dialog label { display: block; font-size: 14px; margin-top: 20px; }
.password-dialog input { width: 100%; padding: 10px; margin: 8px 0 18px; border: 1px solid #a8c5dd; border-radius: 7px; }
.password-actions { display: flex; gap: 10px; justify-content: end; }
.password-actions button { padding: 10px 14px; border: 1px solid #c5d5e0; border-radius: 7px; cursor: pointer; }
.password-actions .password-open { background: #1679e8; color: white; }
@media (min-width: 1600px) {
  .options-layout .colorful-options-bar { grid-template-columns: 138px minmax(360px, 1.1fr) 172px minmax(450px, 1.5fr); }
}
@media (max-width: 760px) {
  .options-layout { grid-template-columns: minmax(0, 1fr) 160px; gap: 5px; }
  .templates-panel { padding: 5px; }
  .templates-button { gap: 6px; padding: 9px; }
  .templates-button > .icon { width: 22px; height: 22px; }
  .templates-button .templates-chevron { display: none; }
  .templates-button strong { font-size: 12px; }
  .templates-button small { font-size: 11px; }
  .templates-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-name { display: none; }
  .page-navigation { justify-content: center; }
}
@media (max-width: 480px) {
  .options-layout { grid-template-columns: minmax(0, 1fr) 112px; }
  .templates-button { flex-direction: column; gap: 3px; text-align: center; padding: 5px; }
  .templates-button > .icon { width: 19px; height: 19px; }
  .templates-button small { margin-top: 2px; }
  .templates-dialog { padding: 18px; }
  .templates-heading h2 { font-size: 20px; }
  .templates-filters, .templates-grid { grid-template-columns: minmax(0, 1fr); }
}
/* Pantalla completa: sólo el espacio de trabajo señalado por el usuario. */
.app-shell.painting-fullscreen { height: 100dvh; overflow: hidden; background: #fffaf2; }
.app-shell.painting-fullscreen .topbar,
.app-shell.painting-fullscreen .activity-menu,
.app-shell.painting-fullscreen .templates-panel { display: none; }
.app-shell.painting-fullscreen .workspace {
  height: 100dvh; min-height: 0; grid-template: 112px minmax(0, 1fr) / minmax(0, 1fr);
  padding: 7px 16px 10px; overflow: hidden;
}
.app-shell.painting-fullscreen .options-layout { grid-template-columns: minmax(0, 1fr); }
.app-shell.painting-fullscreen .canvas-ad-row { height: 100%; min-height: 0; }
.app-shell.painting-fullscreen .activity-work-area { min-height: 0; }
.app-shell.painting-fullscreen .side-toolbar { overflow-y: auto; }
.app-shell.painting-fullscreen .canvas-card { height: 100%; }
@media (max-width: 760px) {
  .app-shell.painting-fullscreen .workspace { grid-template-rows: 104px minmax(0, 1fr); padding: 6px; }
  .app-shell.painting-fullscreen .canvas-ad-row { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .app-shell.painting-fullscreen .activity-work-area { min-height: 440px; }
  .app-shell.painting-fullscreen .ad-slot { min-height: 100px; }
}
/* Mantiene legibles todas las herramientas en pantallas de portátil. */
.options-layout .five-option-buttons { grid-template-columns: minmax(94px, 1.2fr) repeat(4, minmax(62px, 1fr)); }
.options-layout .colorful-options-bar { grid-template-columns: 138px minmax(398px, 1.1fr) 172px minmax(450px, 1.5fr); }
@media (min-width: 761px) and (max-width: 1500px) {
  .options-layout { grid-template-columns: minmax(0, 1fr) 220px; }
  .options-layout .colorful-options-bar { grid-template-columns: 132px minmax(398px, 1fr) 152px minmax(250px, .8fr); }
  .options-layout .category-options { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .options-layout .category-button { display: flex; flex-direction: row; justify-content: center; align-items: center; gap: 5px; min-height: 0; padding: 3px; }
  .options-layout .category-button .icon { display: block; width: 17px; height: 17px; flex-shrink: 0; }
  .options-layout .category-button span { font-size: 9px; }
  .app-shell.painting-fullscreen .options-layout { grid-template-columns: minmax(0, 1fr); }
}

/* V15: toda la pizarra admite trazos; el borde indica el área exportable. */
.canvas-frame { min-width: 0; min-height: 0; max-width: none; }
.canvas-frame.has-document { background: #f1f5fa; }
.page-boundary {
  position: absolute; z-index: 0; pointer-events: none; background: #fff;
  box-shadow: 0 0 0 1px #b7c8d8, 0 2px 7px #233b531a;
}
.page-boundary[hidden] { display: none; }
.file-notice { max-height: 100px; overflow-y: auto; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .page-navigation { flex-wrap: wrap; gap: 4px; }
  .page-navigation .document-name { display: block; width: 100%; text-align: center; font-size: 11px; }
}

/* V16: dos importaciones, catálogo común y navegación en los márgenes. */
.options-layout .colorful-options-bar {
  grid-template-columns: minmax(258px, 1.15fr) minmax(380px, 1.8fr) minmax(146px, .65fr) minmax(176px, .85fr);
}
.import-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; min-height: 0; }
.colorful-options-bar .compact-upload { gap: 2px; }
.colorful-options-bar .compact-upload .icon { width: 22px; height: 22px; flex: 0 0 auto; }
.colorful-options-bar .compact-upload strong { font-size: 12px; line-height: 1.1; }
.colorful-options-bar .compact-upload small { display: block; font: 11px/1.15 Arial, sans-serif; margin-top: 3px; color: #754600; }
.colorful-options-bar .original-upload { background: #e3f6ed; border-color: #a8dcc4; color: #137650; box-shadow: 0 3px 6px #1c775215; }
.colorful-options-bar .original-upload strong, .colorful-options-bar .original-upload small { color: #185c44; }
.select-mold-button { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 7px; cursor: pointer; color: #0b5cb0; border: 1px solid #8bc3f8; background: #fff; }
.select-mold-button .icon { width: 26px; height: 26px; flex-shrink: 0; }
.select-mold-button strong { display: block; font: 800 13px/1.2 Arial, sans-serif; }
.select-mold-button small { display: block; margin-top: 4px; font: 11px/1.2 Arial, sans-serif; color: #4b6e8b; }
.select-mold-button:hover { background: #edf6ff; }
.canvas-frame[data-import-mode="original"] #outlineCanvas { z-index: 1; }
.canvas-frame[data-import-mode="original"] #paintCanvas { z-index: 2; }
.canvas-frame .page-navigation {
  position: absolute; inset: 0; z-index: 6; display: block; min-height: 0; padding: 0; border: 0; pointer-events: none;
}
.canvas-frame .page-navigation[hidden] { display: none; }
.page-side-button {
  position: absolute; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
  width: 42px; height: 66px; padding: 0; border: 1px solid #a7cbee; border-radius: 15px;
  color: #0874d7; background: #ffffffef; box-shadow: 0 3px 10px #17466e18; cursor: pointer; pointer-events: auto; touch-action: manipulation;
}
.page-previous { left: 6px; } .page-next { right: 6px; }
.page-side-button .icon { width: 24px; height: 24px; }
.page-side-button:disabled { opacity: .35; cursor: default; }
.page-side-button:hover:not(:disabled) { background: #e2f0ff; border-color: #1680ee; }
.mold-dialog { width: min(1050px, calc(100% - 28px)); max-height: 92dvh; }
.mold-dialog form { max-height: 92dvh; padding: 22px; }
.mold-dialog-heading { align-items: flex-start; gap: 14px; }
.mold-categories { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 10px; max-height: 240px; min-width: 0; overflow: auto; padding: 4px 4px 9px; }
.mold-category {
  position: relative; display: flex; flex: 0 0 auto; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; min-width: 124px;
  padding: 10px 16px; border: 2px solid transparent; border-radius: 20px;
  color: var(--category-ink); background: var(--category-soft); cursor: pointer;
  box-shadow: 0 4px 0 #23496a12; font: 800 15px/1.2 "Trebuchet MS", Arial, sans-serif;
}
.mold-category-picture { display: block; width: 56px; height: 56px; flex: 0 0 auto; }
.mold-category:hover { border-color: var(--category-color); }
.mold-category[aria-pressed="true"] { border-color: var(--category-color); box-shadow: 0 4px 0 var(--category-color); }
.mold-category-check {
  display: none; position: absolute; top: 6px; right: 6px; width: 21px; height: 21px;
  place-items: center; border-radius: 50%; background: var(--category-color); color: #fff; font: 900 14px/1 Arial, sans-serif;
}
.mold-category[aria-pressed="true"] .mold-category-check { display: grid; }
.mold-dialog #galleryCloseButton { margin-top: 4px; border-radius: 50%; color: #b5566b; background: #fff1f4; border-color: #f5d5df; }
.mold-dialog #galleryCloseButton:hover { background: #ffe2e9; }
.mold-dialog .gallery-title-row { margin-top: 10px; padding-top: 8px; }
.mold-dialog .drawing-gallery { display: block; padding: 3px; min-height: 120px; scroll-behavior: auto; }
.mold-file-section { margin: 0 0 18px; }
.mold-file-section h4 { margin: 5px 0 10px; font: 700 13px/1.3 Arial, sans-serif; color: #647a8c; overflow-wrap: anywhere; }
.mold-pages-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.mold-page { display: flex; flex-direction: column; min-width: 0; gap: 8px; padding: 8px; border: 1px solid #c9dce9; border-radius: 12px; background: #fff; color: #17557f; cursor: pointer; }
.mold-page:hover { border-color: #1680ee; background: #eef6ff; box-shadow: 0 3px 10px #166fb51a; }
.mold-page-preview { display: grid; place-items: center; height: 176px; width: 100%; background: #f3f6fa; border-radius: 7px; overflow: hidden; font: 12px Arial, sans-serif; }
.mold-page-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.mold-page strong { font: 700 12px/1.3 Arial, sans-serif; }
.mold-page:disabled { opacity: .55; cursor: default; }
.molds-empty, .mold-file-error { grid-column: 1 / -1; padding: 26px 20px; color: #526d82; font: 14px/1.5 Arial, sans-serif; background: #f4f8fb; border: 1px dashed #c5d9e9; border-radius: 12px; }
.template-document-icon { width: 65px; height: 65px; fill: none; stroke: #9a7dbd; stroke-width: 1.5; }
.template-preview img { position: absolute; inset: 0; }
.template-download-notice { padding-top: 10px; }
.page-side-button:focus-visible, .mold-page:focus-visible, .mold-category:focus-visible, .select-mold-button:focus-visible { outline: 3px solid #1680ee; outline-offset: 2px; }
@media (min-width: 761px) and (max-width: 1450px) {
  .options-layout { grid-template-columns: minmax(0, 1fr) 185px; }
  .options-layout .colorful-options-bar { grid-template-columns: 250px minmax(342px, 1.7fr) 140px minmax(148px, .8fr); gap: 5px; padding: 5px; }
  .options-layout .five-option-buttons { grid-template-columns: minmax(88px, 1.2fr) repeat(4, minmax(52px, 1fr)); gap: 4px; }
  .select-mold-button { gap: 5px; flex-direction: column; padding: 4px; }
  .select-mold-button .icon { width: 19px; height: 19px; }
  .select-mold-button strong { font-size: 12px; }
  .select-mold-button small { margin-top: 2px; font-size: 10px; }
  .templates-button { padding: 8px; gap: 6px; }
  .templates-button strong { font-size: 13px; }
}
@media (max-width: 760px) {
  .options-layout .colorful-options-bar { grid-template-columns: 252px 350px 145px 172px; }
  .mold-pages-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .mold-page-preview { height: 140px; }
  .mold-dialog form { padding: 15px; }
  .mold-categories { gap: 8px; max-height: 218px; }
  .mold-category { min-width: 102px; padding: 8px 12px; font-size: 13px; }
  .mold-category-picture { width: 48px; height: 48px; }
}
@media (max-width: 480px) {
  .mold-pages-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mold-dialog-heading { gap: 6px; }
  .mold-category { min-width: 0; width: calc((100% - 8px) / 2); padding: 6px; border-radius: 15px; font-size: 12px; }
  .mold-category-picture { width: 38px; height: 38px; }
  .mold-categories { max-height: 198px; }
  .mold-dialog #galleryCloseButton { width: 36px; height: 36px; }
  .page-side-button { width: 38px; height: 54px; }
  .page-previous { left: 3px; } .page-next { right: 3px; }
}

.mold-page-preview { position: relative; }
.mold-page-preview img { position: absolute; inset: 0; min-height: 0; max-height: 100%; object-fit: contain; }
.import-options > .upload-button { grid-column: auto; grid-row: auto; }
.colorful-options-bar .compact-upload small { font-size: 10px; white-space: nowrap; }
@media (max-width: 1450px) {
  .colorful-options-bar .compact-upload .icon { width: 18px; height: 18px; }
  .colorful-options-bar .compact-upload strong { font-size: 11px; }
}

/* V18: selección de imágenes y siete herramientas, sin reducir la pizarra. */
.options-layout .colorful-options-bar {
  grid-template-columns: minmax(250px, 1fr) minmax(570px, 2.15fr) minmax(140px, .55fr) minmax(155px, .7fr);
}
.options-layout .image-tool-buttons {
  grid-template-columns: minmax(98px, 1.2fr) repeat(6, minmax(62px, 1fr));
  gap: 5px;
}
.image-tool-buttons .top-tool-button span { line-height: 1.1; white-space: normal; }
.colorful-options-bar .select-image-tool .icon { color: #176ee0; }
.colorful-options-bar .select-image-tool.is-selected { color: #fff; background: #176ee0; border-color: #1157b8; }
.colorful-options-bar .select-image-tool.is-selected .icon { color: #fff; }
.colorful-options-bar .insert-image-tool { background: #f0faf5; border-color: #abdcc3; }
.colorful-options-bar .insert-image-tool .icon { color: #17815b; }
.colorful-options-bar .insert-image-tool:hover:not(:disabled) { background: #dcf3e6; border-color: #17815b; }
.insert-image-tool:focus-visible, .select-image-tool:focus-visible { outline: 3px solid #1680ee; outline-offset: 2px; }
#insertedImagesCanvas { z-index: 1; pointer-events: none; }
#paintCanvas { z-index: 2; }
#outlineCanvas { z-index: 3; }
.canvas-frame[data-import-mode="original"] #outlineCanvas { z-index: 1; }
.canvas-frame[data-import-mode="original"] #insertedImagesCanvas { z-index: 2; }
.canvas-frame[data-import-mode="original"] #paintCanvas { z-index: 3; }
#imageSelectionCanvas { z-index: 4; pointer-events: none; }
.image-selection-hint {
  position: absolute; z-index: 4; left: 50%; bottom: 12px; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 28px); margin: 0; padding: 7px 12px;
  border: 1px solid #c2dcf7; border-radius: 18px; background: #ffffffed;
  color: #205283; font: 12px/1.4 Arial, sans-serif; text-align: center; pointer-events: none;
}
.image-selection-hint[hidden] { display: none; }
.canvas-frame .processing-overlay { z-index: 8; }
@media (min-width: 761px) and (max-width: 1450px) {
  .options-layout { grid-template-columns: minmax(0, 1fr) 168px; }
  .options-layout .colorful-options-bar {
    grid-template-columns: 218px minmax(488px, 2fr) 125px minmax(137px, .6fr);
  }
  .options-layout .image-tool-buttons { grid-template-columns: 86px repeat(6, minmax(55px, 1fr)); gap: 4px; }
  .image-tool-buttons .top-tool-button span { font-size: 10px; }
  .image-tool-buttons .top-tool-button .icon { width: 25px; height: 25px; }
}
@media (max-width: 760px) {
  .options-layout .colorful-options-bar { grid-template-columns: 216px 556px 145px 172px; }
}
@media (max-width: 760px) {
  .options-layout .colorful-options-bar { grid-template-columns: 216px 556px 145px 172px; scrollbar-width: thin; }
  .options-layout .colorful-options-bar::-webkit-scrollbar { display: block; height: 4px; }
  .colorful-options-bar .compact-upload { padding: 2px; gap: 1px; }
  .colorful-options-bar .compact-upload strong { font-size: 10px; }
  .colorful-options-bar .compact-upload small { font-size: 8px; margin-top: 2px; }
}
