.mosaic-icon {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: 50px;
  height: 50px;
  padding: 7px;
  border-radius: 11px;
  background: #d9efe9;
  transform: rotate(-5deg);
}
.mosaic-icon i { background: #38a49c; border-radius: 2px; box-shadow: 0 2px 0 #197770; }
.mosaic-icon i:nth-child(2), .mosaic-icon i:nth-child(5) { background: #f4c963; box-shadow: 0 2px 0 #c49b39; }
.mosaic-icon i:nth-child(4), .mosaic-icon i:nth-child(6) { background: #ab8cd9; box-shadow: 0 2px 0 #7959aa; }
.mosaic-mode { display: flex; gap: 4px; background: #edf2f5; padding: 4px; border-radius: 12px; max-width: 100%; }
.mosaic-mode button { width: auto; min-width: 0; padding: 10px 13px; background: transparent; color: #475467; font-size: 0.86rem; border: 0; }
.mosaic-mode button[aria-pressed="true"] { background: #fff; color: #146c65; box-shadow: 0 2px 5px #22334a18; }
.mosaic-caption, .mosaic-legend { display: flex; width: min(390px, 100%); justify-content: space-between; gap: 10px; font-size: 0.82rem; color: #60736f; }
.mosaic-caption span:first-child { font-weight: 800; color: #244d48; }
.mosaic-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  width: min(390px, 100%);
  padding: 12px;
  border: 1px solid #c4dcd4;
  border-radius: 15px;
  background: linear-gradient(140deg, #f4faf6, #dfebe7);
  box-shadow: 0 7px 0 #b5cfc5, 0 12px 22px #244d4812;
}
.mosaic-board .mosaic-tile {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #244d481c;
  border-radius: 6px;
  font-size: clamp(0.9rem, 4vw, 1.25rem);
  touch-action: manipulation;
  box-shadow: inset 0 2px 0 #ffffff88, 0 3px 0 var(--mosaic-edge, #c0d0c8);
}
.mosaic-tile:disabled { opacity: 1; cursor: default; }
.mosaic-tile:not(:disabled):hover { filter: brightness(1.08); }
.mosaic-tile:not(:disabled):active { transform: translateY(2px); box-shadow: inset 0 1px 1px #244d4822; }
.mosaic-board .mosaic-axis::after { content: ""; position: absolute; top: -4px; bottom: -4px; right: -4px; border-right: 2px dashed #5c8076; pointer-events: none; }
.mosaic-blank { --mosaic-fill: #f6faf8; --mosaic-ink: #50665e; --mosaic-edge: #bccfc6; }
.mosaic-teal { --mosaic-fill: #75cfc1; --mosaic-ink: #165d56; --mosaic-edge: #399a8d; }
.mosaic-gold { --mosaic-fill: #f5d382; --mosaic-ink: #745313; --mosaic-edge: #c79b3e; }
.mosaic-violet { --mosaic-fill: #cbb3e9; --mosaic-ink: #593b80; --mosaic-edge: #9874c1; }
.mosaic-board .mosaic-tile, .mosaic-palette .mosaic-swatch { background: var(--mosaic-fill); color: var(--mosaic-ink); }
.mosaic-legend { margin: 4px 0; text-align: center; }
.mosaic-legend span { width: 50%; }
.mosaic-palette { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; width: min(360px, 100%); }
.mosaic-palette .mosaic-swatch { min-width: 0; padding: 8px 3px; border: 2px solid transparent; border-radius: 9px; display: grid; gap: 4px; box-shadow: 0 3px 0 var(--mosaic-edge); }
.mosaic-swatch span { font-size: 1.3rem; line-height: 1.2; }
.mosaic-swatch small { font-size: 0.72rem; }
.mosaic-palette .mosaic-swatch[aria-pressed="true"] { border-color: #244d48; outline: 2px solid #fff; outline-offset: -4px; }
.mosaic-actions { flex-wrap: wrap; width: 100%; }
.mosaic-actions button { min-width: 0; font-size: 0.85rem; }
@media (max-width: 420px) {
  .mosaic-icon { width: 44px; height: 44px; }
  .mosaic-board { padding: 7px; gap: 4px; }
  .mosaic-mode button { padding: 10px 8px; }
  .mosaic-board .mosaic-axis::after { right: -3px; }
}
